AS3: Excluding duplicate classes from child SWF to reduce file size - actionscript-3

I'm using Adobe Animate to make a parent SWF that loads other child SWFs. When I'm compiling the child Flashes, is there a way to exclude certain duplicate classes which will already exist in the parent Flash in order to decrease the file size? I assume the child Flashes would no longer be able to execute on their own, but they're not supposed to, they're supposed to only be played through the parent. Is this possible in Adobe Animate, or do I need something like Flash Builder to do that?

Related

What does the garbage collector when you have a movieclip into one frame, and your movie is constantly ending and returning to beginning?

I already know all the problems in programming based on timeline, but I'm curious to know what happens to garbage collector in that situation.
Talking about code in timeline - as a movieclip isn't accessible if the code isn't in the same frame as it, does this raises the possibility of memory leak?
Seems to me that the movieclips in timeline are added when the "playhead" currently is on it's frame, and removed when it goes out.
The Garbage Collector will not be able to clean/dispose a movie clip removed from stage if:
that clip is still playing and does stuff (create/remove other things...)
that clip is still referenced by some other instance that is "reachable"
you try to remove a way too complicated hierarchy containing too many items [I dont have any number for this, but I'd guess around 2^32 items?]
One way I usually use to see if there is a memory leak is to run SWF Profiler in FlashDevelop and force GC to run at certain situations and see what gets deleted.
Please check following article for more information:
http://active.tutsplus.com/tutorials/workflow/quick-tip-understanding-garbage-collection-in-as3/
The code is still apart of that MovieClip. So it is still there. And since the MovieClip is presumed still attached to its parent then it stays.
(I say attached to its parent instead of on screen, because its possible to have parent reference the child, and the child references the parent with the .parent variable, so since they both have something pointing to them, they stay in memory).

Adding multiple children to the stage

I'm a new flash developer. I have read here http://www.flashandmath.com/intermediate/children/stage.html that I should avoid adding children to the stage itself and only add them to my MainTimeLine derived main document class (which is itself a child of stage). However, the author does not give explanation/justification for this approach.
I am developing a project where I am considering adding UI popup windows to the stage directly rather than including them in my MainTimeline (it makes it easier to keep them above everything else and also makes it easier for me to know what I need to persist and what I don't when saving).
What are the downsides of this? Is it a "bad practice" in Flash? Why?
For quick demos and presentations I often use the Flash IDE's timeline to manage my depths. I create empty movieClips and put them on the different layers. For example, my top layer would be my Popup Layer, under that would be my Main Content Layer, under that would be my Background Layer. My main document class manages the adding and removing of popups, content and background instances.
I believe it is bad practice to add children directly to the Stage. Here is a decent thread explaining some differences between MainTimeLine vs stage.

Need flash application gui architecture advice

I need your advice on how to organize a GUI in flash application. See image:
http://dl.dropbox.com/u/32811/Screen%20Shot%202012-04-25%20at%2015.40.31%20.png
Application is video player. I have buttons group that must be hidden when the mouse is out of the player. I added a Sprite, and all my buttons i have added as a child of this sprite. In this case i hide the parent, rather than each button individually.
There are several problems:
When parent Sprite resize occurred, all of his children resizes with him.
I would like to position children relative to their container, but it is very difficult, because i can not set width and height of parent sprite.
I would like to set the width and height of the parent Sprite, position buttons inside, and any resizing in it will occur automatically.
The question is: I am using the wrong tools, or use them somehow wrong? Are there any GUI frameworks that can help with building layout?
write this line at Creation Complete Event or any where at beginning of code
fscommand("allowscale","true");
it will maintain aspect ratio of application so all children of application will resize and scale properly
try this it will work

AS3 3D Tween not working

I have an animation that is created in flash, I have used the 3d tween changing many angles and rotations over 60 frames
playing this animation works fine by its self, The "snowy Screen is the 3d tween"Below is the object rotating
When I load this SWF into another Main SWF the 3d tween is ignored.Below
is the problem
Im hoping some one can explain if this is a glitch of some sort..
I have exported into different flash versions and have created different loader classes to try and find a solution.
Thanks
I have encountered this before and it killed me. If you load one 3D tween into a different SWF the parent SWF will control the perspective (there can only be one perspective per SWF at least as of Flash 10 player). You will need to set the perspective values identically in both the loaded SWF and the parent SWF. This one aspect of Flash 3D turned me off so much I do not use the feature at all anymore. This even goes for different assets dynamically parented together.

Animation stops working after swapping

I have a class which extends a SWC , in the swc i have two boxes, front and back and an animation on the same timeline. The animation works fine without swapping when I swap them the animation stops working. Anyway I can make it work?
I have the following code :
var frontTemp:DisplayObject = this.animationInstance.getChildByName("front");
var backTemp:DisplayObject = this.animationInstance.getChildByName("back");
this.animationInstance.swapChildren(frontTemp,backTemp);
this.animationInstance.gotoAndPlay("animation");
The short answer is, you should avoid using both frame animations and scripts on the same objects. Basically, frame animations and scripts are two different ways to control the properties of clips (position, size, stacking order, etc). And if you use them both, Flash has no unambiguous way to know which set of instructions should take precedence. The way Flash deals with this problem is, once you use scripts to update something, it is no longer affected by frame animations from then on (unless it gets removed from the stage and re-added).
I posted a couple of general ways to fix this kind of issue in answer to this question - please have a look.