Assign movie symbol to class error , cannot export in .mov in Flash CC? - actionscript-3

Please kindly help me otherwise my 8 hour hard work of animation would be lost.
So I manually create a movie symbol in my Flash Main Timeline, it has an actionscript code in it like:
stop();
if(MovieClip(root).currentFrame<MovieClip(root).totalFrames){
MovieClip(root).nextFrame();
}
Converting it into a .mov file would not play the movie symbol (with its actionscript code like above).So I manually go and assign this movie symbol a class (Right-Click -> Properties ->Advanced ->Class Name)
After clickikng OK, it displays me an error saying "A definition for this class could not be found in the classpath, so one will be automatically generated in the SWF file upon export.
I right-clickthe name->Edit Class. Opens up with an empty constructor, but whwre is the animation code (like the 20 frames in this movie symbol)?
How do I export the .mov file so it plays the movie symbols (multiple instances of the movie symbol as well)?

"A definition for this class could not be found in the classpath, so one will be automatically generated in the SWF file upon export" -- I would not worry about this. It is simply saying that an actual class file does not exist.
Also, that as3 code will not execute on movie export. It is dependent on the animation playing in real time.
I would recommend removing this code, creating a keyframe on the very last frame, and in that frame inserting a stop();
Your frames will play all the way through until the last (stop) frame.

Related

external document class injected into a timeline based Flash app

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!
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.*;

Only the loader images are being exported in frame 1 but the loader still only shows up at 100%

As the title says, the file loads correctly but the loading screen only flashes up at the end.
The only thing being exported in frame 1 is the loader image, and that is extremely small.
Is it possible that there's a queue of things being loaded and the loader image is at the bottom of that queue? Since that was one of the last things added to the project
If your preloader only shows up after the file has loaded, this means that you still have other objects being linked onto Frame 1. Flash is very picky about this, and it's easy for things to be yanked onto Frame 1 regardless of your settings. When you compile, Flash builds a dependency graph to determine what items are needed on each frame. If it thinks an asset is needed earlier than the export frame setting, it will ignore the setting and push the asset onto that frame. In particular, any class that your document class directly references will be automatically yanked onto frame 1.
Checking "Generate size report" in File, Publish Settings, Flash can help you see how much data is being exported onto Frame 1. Here are some tips to ensure that everything is linked onto the proper frame:
In Publish Settings, Flash, ActionScript Settings, make sure that "Export frame for classes" is set to 2 or higher.
Ensure that library symbols say "Export on frame 2" in their linkage properties. Older versions of Flash may export them on frame 1, regardless of the class export frame. In this case, you'll have to do the oldschool method of unchecking the "Export on frame 1" option, and manually dragging these symbols onto the timeline on frame 2.
Do not directly reference classes from your document class or on the main timeline. The Document class and all the assets it references are always placed on frame 1. Anytime you do var f : MyClass; in your document class or on the root timeline, then you are referencing MyClass, and Flash will automatically yank it onto frame 1.
To avoid directly referencing your main app class in your preloader, you want to instantiate it indirectly, using something like this:
var gameClass : Class = flash.utils.getDefinitionByName("Game") as Class;
var game : Sprite = new gameClass();
In this case, your Preloader becomes the document class, and indirectly creates the Game class when the SWF has loaded. This avoids any direct references to Game and its content.

ActionScript not showing up in Actions - Frame window in Flash CS5

In an existing fla file, I'm not able to find strings within actionscript that is contained within certain frames (regardless of which frame it's in). So for example in frame 1 there is the following code:
stop();
But searching for 'stop' (without quotes) doesn't turn up any results.
If I create a new fla file, I'm able to find actionscript in all keyframes. Furthermore, I've noticed that the "Actions - Frame" window shows me a tree of all the ActionScript in the scene, organized by frame. This isn't happening in the first .fla file - I can open up and edit actionscript for a frame, but the tree/index never gets built.
Has anyone run into a situation like this? Is the first .fla corrupt in some way, or is there a setting to allow me to easily find actionscript within all frames? Thanks!
Have you checked the settings in the search box? Maybe the search is document based and the specific file you are having trouble with has different settings from the default one. Try to compare the working file with your "corrupt" file. Actionsctipt should be enabled.

AS3 preloader sorrows, unable to load symbols from library

I created an AS3 preloader, and placed the code for that on frame one.
I then made a symbol, and placed it in the library. It was set to NOT export on frame 1, and the fla's settings had all classes exported on frame two. There were no references to the object until frame two.
Then, flash crashed whenever I compiled without the "Export in frame one" box checked.
To fix this, a friend suggested I start my game logic on frame 3, so it will have properly loaded frame 2. That seemed to work fine, the class was instantiating properly.
Then, it turned out that it was not loading the movieclip, only instantiating the class. Again, this could be fixed by exporting in frame 1, but I really cannot afford to do that.
The same friend suggested I place an instance of the symbol on the stage on frame 3, and perform game logic on frame 4. They said this would initialize the movieclip properly.
However, this was not the case. How can I load the entire symbol, graphics and all, without exporting to frame 1? This single symbol will contain probably 10-20 MB of graphics, so it needs to be preloaded.
Thanks for the help!
EDIT: To make a long story short, all I need is some way to load a movieclip so it can be used and visible and everything.
EDIT: Is there any way to force-load a movieclip via AS3?
Hard to figure out from descriptions.
If you make a new .fla file, paste your large(10-20MB) clip on frame 2,
set your export frame as 2, then try to preload from frame 1 and access the large clip's content in frame 2, do you get the same error ?
say you have this in frame 1:
stop();
this.loaderInfo.addEventListener(Event.COMPLETE, onComplete);
function onComplete(event:Event):void{
gotoAndStop(2);
}
and in frame 2:
trace(myLargeClip);//where myLargeClip would be your 10-20MB clip
It should be ok, otherwise, in case tracing your large clip returns null, you might want to try to invalidate the stage:
on frame 2:
stage.addEventListener(Event.RENDER,onRender);
stage.invalidate();
function onRender(event:Event):void{
trace(myLargeClip);
}
Basically what I'm suggesting is:
Isolate the problem. See if your large clip is causing problems in a similar, but simplified scenario and why, then once you got a fix use it in your main fla.
Try the stage invalidation, although, since I don't fully understand your setup, it's just a wild guess.
HTH,
George

How is the Actionscript 3.0 sample Maze game's code included?

I can't find the line in the Adobe samples for a maze game where the actual .as code is included into the project. This is fundamental, since my own implementation is just using include "file name";, which isn't working. I also can't use import, since I then can't access the elements placed on the stage. Help, please? The files are available here http://download.macromedia.com/pub/developer/flash_as3_sample_game_1.zip
I tried to debug the code, but I can't even find the point where the constructor is called. The execution starts at "stop()" in frame 1 and then if you step into it, calls the enter frame event handler.
I guess Document Class is the thing you are looking for.
It is an entry point, the class which is instantiated once Flash Player loaded your SWF.