ActionScript 3.0 :: Flash Loaded Swf Timeline And Duplicating When Adding To Stage?
Sep 7, 2010
I have a couple swfs that are loaded in using Loader, my first problem is I want to stop the timeline until another function when I want it to start. so In the complete function I have
var swfMC:MovieClip = e.target.content as MovieClip ;
swfMC.stop();
but the swf still runs through.Another problem I am having is whenever I add it to the stage it seems to make a duplicate of the swf, and when I remove this duplicate it remains til flash finally crashes. There isnt anything but simple tweens in my swf's (and added trace statements), so they shouldnt be held into memory. that and they shouldn't have been duplicated in the first place... right?
I have a Movie Clip object with a timeline, and it has 3 layers: a layer to stop the timeline at the last frame, a layer with regular drawing with mask attribute and a layer containing a target movieclip with the instance named 'target', that is masked by the layer above.
The drawing is very simple, not even a movieclip, just vector drawing. It's supposed to show the target movieclip only on regions where the mask layer has some drawing, right?
So, I created the method to load an image, listen to the complete loaded event and add the image to the target masked movieclip, but it disappears after the first frame! If i delete the layer with the mask drawing, works fine.
I am using gaia with a fluid layout at here is what I get: This is the error: TypeError: Error #1009: Cannot access a property or method of a null object reference. at com.gaiaframework.FluidLayout::FluidObject/reposition() at com.gaiaframework.FluidLayout::FluidObject() at pages::MemberPage()
Here is my MemberPage code: package pages{ import com.gaiaframework.templates.AbstractPage; import com.gaiaframework.events.*; import com.gaiaframework.debug.*; import com.gaiaframework.api.*; [Code] .....
Note there may be some extra classes and imports etc. I was trying a bunch of things. The full fluid layout tutorial I followed is here: [URL].
i have a UILoader that loads an image from an xml list when you click its thumbnail ( in its thumbnails mc on mainstage aswell) thing is, i have another UILoader on the layer above that loads in a swf ( a slideshow that fades in and out the pictures when they change to the next, with all the coding on frame 1, frame 2 only has a stop and some code for when the mouse is idle for 5 secs it goes back to frame 1) so when you go to "portraits" it takes you to frame "x" where the slideshow ( loaded external swf ) starts playing automaticly right, if i click any thumbnail the slideshow goes to frame 2 ( wich is perfect and the mouse idle thing i wanted works great ) the ONLY THING IS
after the slideshow runs by default for the first time ( i enter the category portraits ) and i click any thumbnail ( moving slideshow swf to frame 2 enabling mouse idle event ) and the mouse is idle ( so it does the event and starts playing the slideshow again ( goes back to frame 1 ) ) I CANT MAKE THE UILOADER OF THE THUMBS IMAGE TO DISSAPPEAR!
when copying one timeline to another it keeps asking me to 'replace existing items'.When i do this it pastes 2 instances of the same item on my page + another random item.
i want to have a copy of it and add new features to it. rather than re coding the whole thing again but when i duplicate the movie clip and make the changers the original is effected as well.
I have made a slider that I am having issues with. This slider is to control the timeline of a movie clip when dragged. My problem with this is that It seems to be duplicating the first frame. When I slide the slider to the right it will hit first tick and still display what is in frame 1 .. then on the next ticks it will continue with the rest of the timeline. how to prevent / over come my slider from doing this with the first frame?
The main fla file loads an external swf file that is a movie clip that has the card art images (one card art on each frame)
This works good and I can view the loaded swf on the stage.
public function FinishedLoading(loadEvent:Event):void { LoadedMovie = MovieClip(loadEvent.currentTarget.content); addChild(LoadedMovie); }
What I want to do in another function is to duplicate the load swf, so that I can have 52 of the same object, each with a different picture. I need to know how to create an instance of the loaded swf.
I would like to control each instance of the loaded swf by telling each one independently of each other to go to and stop at a specific frame such as 3 or 17, or 43, based on what card is needed at that time.
I'm working on an online flash gaming platform. We load all our graphics in externally from a library. I want to be able to load something in, then duplicate it for reuse.
So, I came across senoculars example code for duplicating DisplayObjects. This is where im getting problems. Some of the loaded assest have a few bits of timeline code (basically stop() on animated parts which have multiple animations. also, there are locators in there which are used for the collision detection engine, and these have this.visible=false commands in them).
When i load in a graphic asset, everything works fine- all timeline code executes, the loaded in swf behaves exactly how i want it to. When i duplicate it, buried timeline code is being ignored. Also, even more bafflingly- until i put some kind of timeline code on the top layer of the movieclip that is being imported and duplicated, the duplicated display object wouldn't display at all when added to the stage. (just putting a stop or trace at the very top layer made it work)So i do something like this to load a swf in, and duplicate it
Code: var myDoAfter = function(mcLoader:Loader) { loadedGraphic = mcLoader.content var newClone = duplicateDisplayObject(loadedGraphic)
[code]...
I've waffled already, and have tried to keep the code brief. Im sure some people are going to say 'never put code on the timeline in AS3' which is probably legitimate (its not all my doing).Still, i am intreagued to suss it out. Is it that, using this method of duplicating (ie getting the constructor of the thing im trying to duplicate), timeline code is simply going to be ignored?
why can't i duplicate something unless it has some timeline code at the top level? Even when it doesnt, the initial load of the asset works correctly- i can add the original to the stage, but its clones seem to be empty.Might it be something to do with the casting of the thing loaded in? (ie that Loader.content is going to be a displayObject rather than a MovieClip) ?
I'm building an image gallery which creates thumbnails by sizing down the original images and once you click on one of them it duplicates itself and displays on top with full scale. I searched the web and everybody say duplicating dynamically loaded image can not be done and only solution is to reload the image. And because they are cached when they were first loaded it shouldn't take much time to get loaded. Also I heard that there is way to force the browser to cathe the image...
I'm working with a script that loads from an XML some jpgs, these ones once loaded move to their positions.
[Code]....
the problem is that i would like put all these movies well aligned in rows and columns, i've seen it's possible to do this with a nested for.. loop, something like this
I am duplicating a movieclip on the stage in which Flash labels them in order.AKA. ball1...ball2....ball3....ball4...etc.I'm trying to change the color of all of them from another button and so far I have to do it like this: Is there a shorter way?
on (release) { var visitedcolor = new Color(_root.bb.t1.screen); visitedcolor.setRGB(0x00FF00);
I'm looking for a way to duplicate a movie clip outside the stage in a random position. it doesnt have to be duplicated in that position, i can do onClipEvent(load) but i just need to know how to put a movie clip in a random position OUTSIDE the stage,
I am trying to duplicate a text field. First I get the text with a mc.getChildAt(0) and then copy all the contents into a new textfield. The problem I am having is that getChildAt removes the textfield from the movieclip it is in. How to I get the properties of the textfield without moving it? Or maybe it is something else and what I am doing is fine
var dupeTField:MovieClip = duplicateTextField($value.sourceImg.getChildAt(0)); private function duplicateTextField($textField):MovieClip {
I have this quickBox2d code to add a cricle to the stage: var ball:QuickObject = sim.addCircle( {skin:skinMc, x:10, y:10, radius:3, density:0 } );
The skinMc contains animations so I want to be able to refer to it like this: skinMc.gotoAndPlay(5); but it says Type Coercion failed: cannot convert skinMc$ to flash.display.MovieClip. ball.gotoAndPlay(5); doesn't work either since it's a QuickObject, not an mc...
I have a AS3 Flash file with some animations during the timeline. On the timeline I also have a stop() in the middle (on a keyframe). When I run this SWF file it does stop. But if I load if from another Flash file using a Loader object it does not stops (nor runs any other action script - i.e.: trace("hi")) I'm also including the context with the current application domain:
I am trying to add multiple different versions of the same button to the stage and to be able to access them later on by assigning them an ID. The way I assumed this would be done is to have a class for the button where an internal static variable is defined so that the ID can be found in the next function. This does not seem to be working, as the ID is constantly showing as the last number given, so in this case 6.I assume that I am doing this wrong? Here is my code so you can better understand:
Code: function AddYCoins():void { for (var i:int = 0; i < 10; i++) { var Ycoin:YCoin = new YCoin();
[Code]...
This function creates 10 instances of my YCoin and places it around the stage. But i wish the coins to only fall in specific areas, (i.e. i have 8 green rectangles, names area1,area2 etc) because the idea is you have to collect the coins but only staying on the green rectangles.
i knows its the stage.stageWidth i need to change but i cant think what to change it too!
How should I go about cloning an image loaded form the server and adding it to the end of the first image loaded? Would I use bitmap clone? My attempts with this failed[URL]
Code: //Creates new image loader var imageLoader:Loader;
So, can I access layers on this MainTimeline to get all Movie Clips on this layer ? So I can do a simple operation "A_1_2.buttonMode = true;" to all my MC's (in an array for example) without writing every line (lot of MC's on layer and lot of lines).
I'm using the suggested method of duplicating a swf that has been loaded by a Loader object. However, the player thinks my swf is AS2 when it definitely is AS3. The Error Message: Quote: Warning: An ActionScript 1.0/2.0 SWF file has loaded an ActionScript 3.0 SWF; code in the ActionScript 3.0 SWF will not run. The duplicate a swf stratgey:
I tried trial and error by tracing strings so I could understand the program flow of actionscript(or any similar language in general) but to no avail; I couldn't understand it at this point or maybe it because I didn't eat my breakfast. Please explain to me why the trace statements showed in the output first?
Here's the code of the first Frame
import flash.events.MouseEvent; import flash.events.Event; trace("I'm in line 3!");
[code]....
What I'm trying to do is to trigger an event when the stage is loaded; It generates some URL of images and inject them into an array then trace it back.It is very crucial for me to understand the flow, I don't want to move forward without understanding this.
If I have a swf that's being loaded into other peoples' swfs (which I have no control over) is there any way I can get properties from the stage (such as height, width, fullScreenHeight, etc.) or does this have to be exposed by the loading swf?
I have 60 pictures- set sequencially in frame by frame animation.I would like to enter them (imported or from the library- whatever works) into the timeline one picture per frame (or keyframe) so when I can hit play and see the animation.
I created 5 swfs (simple, short animations) The swfs are named "movie1," "movie2," and so on. I want to import all 5 movie clips and thread them together so that they play one after the other inside the timeline of a new Flash Document. I am hoping to have "movie 1" play, stop, have "movie 2" play, stop and so on until the 5th "movie plays then stops (no looping necessary). It will be played on a Mac laptop and not online.
I've been fiddling with timeline actions for 2 days and can't figure how to lead one movie to the other. I've been using Action Script 2 so far. What I've done is create 5 layers (1 for each clip)
"movie1" is on layer 1, frame 1 "movie2" is on layer 2, frame 2 "movie3" is on layer 3, frame 3 "movie4" is on layer 4, frame 4 "movie5" is on layer 5, frame 5