soumavachakraborty / gaforflash

Automatically exported from code.google.com/p/gaforflash
Apache License 2.0
0 stars 0 forks source link

Flex 4 support #66

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Try to instantiate the FlexTracker in a Flex 4 project using 
FlashBuilder 4 beta 2

What is the expected output? What do you see instead?
Expected: Nothing, but the tracker should be instanciated.
Actual: Runtime error, because Application.application is null

What version of the product are you using? On what operating system?
Version: 1.0.1.319 on Windows 7 

Please provide any additional information below.
Suggested solution:
Change signature of constructor in FlexTracker.as to:
        public function FlexTracker()
        {
            super();

            _tracker = new TrackerCache();

            /* note:
               to avoid to create a hard reference to 
Application.application
               we get the class by reflection
            */
            var appclass:Object = getDefinitionByName( 
"mx.core::Application" );
            if ( appclass.application != null )
            {
                _app = appclass.application;
            }
            /* Flex 4:
               Use of Appliction.application has been replaced 
by FlexGlobals.topLevelApplication
               this will make tracking in flex 4 possible
            */
            else
            {
                appclass = getDefinitionByName( 
"mx.core::FlexGlobals" );
                _app = appclass.topLevelApplication
            }

            _app.addEventListener( Event.ADDED_TO_STAGE, _factory );
        }

Patch included for easy adaptation :)

Original issue reported on code.google.com by NielsBjerg on 5 Feb 2010 at 1:58

Attachments:

GoogleCodeExporter commented 9 years ago
thanks for the info

Original comment by zwetan on 12 Feb 2010 at 7:40

GoogleCodeExporter commented 9 years ago
Issue 74 has been merged into this issue.

Original comment by zwetan on 14 Oct 2010 at 8:00

GoogleCodeExporter commented 9 years ago
I was still getting an error finding: Application.

So i changed the code to something like this:

try
{
appclass = getDefinitionByName( "mx.core::Application" );
_app = appclass.application;
}
catch (e:Error)
{
appclass = getDefinitionByName( "mx.core::FlexGlobals" );
_app = appclass.topLevelApplication;                
}

Original comment by kylewar...@gmail.com on 2 Dec 2010 at 12:29

GoogleCodeExporter commented 9 years ago
I guess the right thing would be to check appclass!=null, not going for any 
properties...

Original comment by synomatic@gmail.com on 9 Dec 2010 at 7:34

GoogleCodeExporter commented 9 years ago
Hi,

I'm sorry but the stats don't work with the Flex SDK 4.1.
How can I use this patch with your .swc file ???

Original comment by guitardc...@gmail.com on 6 Oct 2011 at 9:51

GoogleCodeExporter commented 9 years ago
Where is the problem?

The tracking works without any problems on a Flex SDK 4.5.1 project!

Checkout the current source!

Original comment by marcus.f...@googlemail.com on 6 Oct 2011 at 3:29

GoogleCodeExporter commented 9 years ago
I've checked out the current source, but what do I do next? I've moved the 
contents from the "src" folder to my project and could import it, but it gives 
me an error with the "log.as"

What do I have to do after checking out the current source? Could someone 
update the  "official .swc download"? Google is "officially" pointing to it but 
it doesn't the .swf doesn't work anymore.

Thanks in advance!

Original comment by gust...@pligus.com on 25 Jun 2012 at 4:37

GoogleCodeExporter commented 9 years ago
I also get issues regarding Log.as in a flex 4.5.1 project.

Original comment by ryan.mas...@gmail.com on 16 Oct 2012 at 10:33