Question

Here's the situation:

Making an app in Flash CS6 that has 11 frames. Some frames have actions dependent to that frame and then there are some global actions. There are no external classes, everything is incorporated into one flash file.

Now I want to incorporate AdMob and found an offer that should work for me, but it calls for setting a document class linked to external AS file. Doing this messes up my timeline based actions.

I am more front-end that back-end when it comes to designing/programming. So, my question is: How can I incorporate this external admob actionscript into my flash document file without messing up my current scripts? Is there a way to remove it's package attributes and put it on the timeline?

Hope this description wasn't confusing.

Thanks!

Was it helpful?

Solution

Some brief about document class & classes & timeline :

Consider the whole stage as a movieclip. Now the document class would be a user defined, external class for the stage movieclip. When you don't specify the document class, flash uses a predefined one, which derives a plain movieclip class. The frames added from the IDE are converted as calls to addFrameScript and the script in the frames are scheduled to run at an interval as per the frame rate (timeline). Even the shapes you draw, images you add, everything goes in as code in the frame scripts of the stage movieclip.

Now if you add a movieclip onto the stage, the above process is repeated for it as well. You may set a class or derive from an existing class for any movieclip. The class will be initialized when the movieclip instance is created, Be it frame script or place the movieclip itself in the frame.


Now to your question.Any frame script can access the external class as well. So if you have an external class named AdMob in a file AdMob.as, lying next to the fla, you may call it anywhere, in any frame as:

new AdMob()

However you must take care of the package name & path. So if the package for AdMob is abc.bbc.AdMob then the location of the as file should be abc/bbc/AdMob.as

You may import the whole package as :

import abc.bbc.*;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top