ActionScript 2.0 :: Clips Using AttachMovie Loaded Into The First Frame?
Aug 10, 2004
I have 5 frames in a Flash file. The fifth frame is the only frame that contains several attachMovie actionscript call lines. Each of the clips that are called using attachMovie contain large image file sizes. When I used debugger, I noticed that the bulk of the data is not being loaded from the 5th frame, but from the 1st frame instead. Is this supposed to happen? If this is so, the preloader that is being referenced on Kirupa doesn't seem to work properly because it loads all the attachMovie frames first before the preloader is able to perform its own action. What happens is that 80% of the movie will load (I predict from the attachMovie call lines) before the preloader actions and its visual representation will appear.
I tried directly attaching these movieclips to the last frame along with the attachMovie(), thinking that phyiscally placed frame would have a higher priority. But the debugger still informs me that the bulk of the data is being loaded at the 1st frame. Is there another workaround for this or another preloader that someone can recommend? This is the preloader I used: [URL]
Im trying to load a 6FPS SWF into a 30FPS SWF, and the problem is that the 6FPS once loaded plays at 30FPS because it takes on the stage frame rate of its parent swf. To fix that I tried using stage.frameRate in the Parent SWF to slow the frameRate of the loaded SWF animation back to 6FPS. The results is that changing that frameRate changes the frameRate for the all objects on stage, and thus all of the other content in that 30FPS parent SWF now slow down to 6FPS too
Is there away to control just the frameRate of that one loaded SWF animation without effecting all other content that is on state of the parent swf ?
Here's my parent SWF code:
function startLoad(a,b){var imageloader:Loader = new Loader();imageloader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaded_image); imageloader.load(new URLRequest(a));
I want to add 5 movie clips to the stage. The movie clip at this point is just a red box and called testMovie. Ultimately i want to have 5 red boxes displayed on screen tiled vertically one under the other. Here's the code i have so far:
I'm using a Movie Clip (mc1) as a button and for it to be able to function with a mouse click, I placed a Button symbol (b1) inside of the Movie Clip and put some ActionScript onto the nested Button symbol:
Code: on (release) { _parent.attachMovie("mc2_id", "dot", 100); dot._x=150; dot._y=100; }
As you can see, I'm trying to get another Movie Clip (mc2) onto the stage and that part works fine, but for some reason it keeps ending up at the top-left corner of the stage even though my code says otherwise. What am I missing? I'm including the .fla if anyone would be kind enough to look at it.
Also, when I was setting the linkage properties for the clip to be attached, I had to enable the "Export in first frame" function just so it would work (I normally don't since I was told it would kill a preloader if I had one); how would you export things without having this box checked if you normally don't do that sort of thing because of a preloader?
Still plugging away, but I've run up against a problem that seems like it should be easy to fix, if I only knew how. Made a hairline for use in drawing lines with attachMovie(). Wanted to test it by making a "crosshair" at (100,100). You'd think:
how to put Movie Clips on my stage using the attachMovie command, but they always appear in the upper left corner of the screen. How can I get them to appear in a predetermined area of the stage, without having to edit the Movie Clip itself?
Now that I'm on the verge of madness I must consult the forum. I'm simply trying to take one movie clip I made, make it behave like a button, and attach multiple instances of it on my stage, each of which will load a different image to the page. Therefore each movie clip instance contains one crucial bit of unique info -> a number.
That way when I click on the upper left movie clip button it will load ["poster"+this.num] where this.num = 1 and so on. Im having a heck of a time talking to the variables stored in my movie clips... tried to do an onLoad since I only want to set it once but to no avail. any ideas? i'm confused myself just trying to explain it so i'll attach the fla, it's not too big.
'm pretty new with flash and right now I'm stuck with a problem that I don't seem to come out off. I'm working on my new site that has 3 sections that each load a movieclip using attachMovie. Now the problem happens when I load the slideshow, its all broken and even if I change the _root to _parent or this, it doesn't work
I have 3 pages of a document converted to symbols (i.e. mc_pg1, mc_pg2, mc_pg3), each residing in its own frame (i.e. "pg1", "pg2", "pg3") inside mc_Pages. Mc_pg1, mc_pg2, and mc_pg3 are inside a movieclip called mc_Pages. On click of mc_Pages, I am attaching a blinking icon (mc_Target) to a specific page. The problem I'm having is when I attach mc_Target to a specific mc in its frame, navigate to another frame, and then return to the initial frame, mc_Target is no longer attached. Yet, I have not clicked anywhere else other than the buttons that allow me to navigate from one frame to another. So, my code is:
mc_Pages.onPress = function():Void { if(varPg1 == true) //this checks to see if I'm on "pg1" frame where mc_pg1 is located {
[code]....
Everything is working as it should, i.e. on press of the mouse button, the mc_Target is attached to the frame/mc within mc_Pages that I'm in (I have a btn_Next and btn_Previous on the same timeline as mc_Pages that navigates to the specific frames inside mc_Pages), except that upon returning to a frame/mc which previously had mc_Target attached, mc_Target is no longer there.
I'm making a game...and I want to change my background image depending on where the character is.I thought I would make a MovieClip...with all the different background images on different keyframes.My question is....can I use AttachMovie, and if so...how do I reference the particular frame that I want to...?I've never used AttachMovie before, and wasn't sure of the syntax...and how to reference it...to go to a particular frame.
is it possible to use attachMovie without exporting the MC in the first frame.because i tried to do it so i wouldn't have problems preloading, but when i uncheck export in first frame it doesn't show up at all. here is my code just in case it mattered.
i have five buttons 'b1, b2, b3, b4 and b5' and 5 mc 'words1, words2, words3, words4, and words5' being attached to an empty mc on root called 'holder'.
Code:
for (var i = 1; i<6; i++) { _root.nav["b"+i].onPress = function() { num = this._name.toString().substring(1, 2); _root.holder.attachMovie("words"+num, "words"+num, _root.holder.getNextHighestDepth()); }; }
I need to use a ScrollPane in my site to show several photos.My site is set up to load MC's to the MainStage using attachMovie.One of my MC's is named Photos. If I add a ScrollPane to Photos with content called Pics (another MC containing all the photos.) it won't scroll What is the proper method of adding a ScrollPane to a MC called with attachMovie?
What I have is a news blogger that is loaded via xml which uses php to write to the xml file. I have my "blogger" movie clip that loads all of the different blogger info into it. It is loaded into a blank container movie clip via attachMovie and when the user adds a new blog it creates new instance of it and moves the rest down. All works great with that.
Now the problem is after the client creates more then 3 blogs, it begins to run off the site. So what I need to do is put it into a scroller. Now I have gotten it into the scroller but it seems that the scroller is not seeing the actual size of the container clip that is holding all of these instances of the "blog" movie that is loaded from attachMovie. The size will change depending on how many blogs there are and I need to figure out how to add script to calculate that. Here is the code I have to load the "blogitem" movie into the blank container movie.
Code: var i = 0; if (gateXML.hasChildNodes()) { child = gateXML.firstChild;
I'd like to control a movie clips current frame by another movie clips action script.I realise the following controls the outside (root) frame time line:
on(release){ _root.gotoAndStop(1); }
but I'm not sure how to apply that to my other movie clip. I'm guessing it would be something like this:
I have three buttons, btn_1,btn_2,btn_3, and two movie clips, image_1,image_2. The names listed btn_1,btn_2,btn_3, image_1,image_2. are all instance names. All buttons and movie clips are on their own layer in a single frame on the main time line. the movie clips have a stop action on the first and last frame, with a frame label, on the first frame in the sub time line. For image_1 the frame label is image_1_1 and for image_2 the frame label is image_2_1.
I would like btn_1 and btn_2 to control the movie clips, image_1,image_2. Either button should be able to close the other buttons movie clip and play it's own movie clip. Also i am trying to make the movie clips themselves have the ability to be closed by clicking on the movie clip image area that is playing. Both movie clips when not playing hide behind the appropriate button with an alfa of 0.
When playing they expand to the middle of the window and are at 100% alfa, using a tween. The third button, btn_3 should only be visible when one or the other movie clisp are playing. btn_3 dose nothing else but this for now. As of now, my movies continuously loop and btn_3 is always visible. I can't seem to figure this out. my code for this action is:
I have a swf that is loaded into my main swf with the loader class. When I click a button in the main swf I want to call a function in the loaded swf Main class.
When I do a trace it is showing the loaded clip as [object Home] which is the name of the Main document class associated to the loaded swf. I have a public function in my Home.as called startAnimation() but when I try to call it I get
[quote]1061: 1061: Call to a possibly undefined method startAnimation through a reference with static type flash.display:Sprite.
I am creating a 40 slide presentation with soundtracks, narration, and animations.Each slide is a separate swf clip).I have noticed that when I load a new clip, the previous clip is still loaded (I wasn't using any background so I could see through the first clip and see the second).This tells me that I should consider unloading the previous clip or use backgrounds.Putting on a background is easy however if I should want to unload the previous clip, how do I do that?Here is how I load the next clip:
mmBtn.addEventListener(MouseEvent.CLICK,loadMM);function loadMM(event:MouseEvent):void {trace("Main Menu Button was Pressed")var loadMain:Loader;loadMain = new Loader();addChild(loadMain);loadMain.load(new URLRequest("mainMenu.swf")); }
Some slides will have many navigation options and others will only have one or two.I have AS in each slide to keep each slide self contained. This makes it easier for me to develop and test.Is there a way to remove the current slide contents (from the stage and memory) and load the next slide? I'm really concerned about the memory usage.
I wrote some actionscript that would load in different values from an xml file in order to play certain movie clips at certain times from a specified swf file. It actually works for the most part. I think the problem happens when I select a movie clip that was already previously selected. It actually won't load it at that point. I will post actionscript in the morning, but I feel like this should be a rather common issue, and I just don't know some general piece of info. I use an actionlistener to load the swf. I create an associative array that works as follows [action] => movieclip Then on an action it will make a movie clip object = loader.content.getChildByName(theActions[action]);
I hava a move clip called Main in witch I load Interface and than load Content swf clip.I was trying to control a object (movie clip in loaded Content swf clip) with asctionscript in Interface swf and inversely, but nothing happend.I hava a button on the interface which I would like to activate when I click on the some area of the Content swf .
If I have SWF's that I am using for UI elements in a game, and in these SWF's there are layers with Movie Clips and these clips have only one frame in them - do I need to explicitly put a stop() in there for optimal performance?
I'm curious if these movie clips sit there and loop with only one frame and in the end hurt the game's overal FPS
If I have SWF's that I am using for UI elements in a game, and in these SWF's there are layers with Movie Clips and these clips have only one frame in them - do I need to explicitly put a stop() in there for optimal performance?I'm curious if these movie clips sit there and loop with only one frame and in the end hurt the game's overal FPS
I have a movie clip where I store a value in a variable called "yourname" and then load a different .swf file in level 1. I display the value of "yourname" in a dynamic text box, that works fine. I then move on to a frame where the user has an input text box and can re-enter a value for the "yourname" variable, and then clicks a button symbol to reassign the value. Bear in mind, "yourname" was not originally stored on this level and this movie clip, it is stored on level 0 on the first (main) movie clip. Here is my code in the button:
on (release) { _level0.yourname = String (inpt_newName.text); }
inpt_newName is the input text box. My intent here is to have a "main" timeline where variables are stored, and then load and unload various .swf movie clips as needed, storing and variables (i.e. decisions) that the user makes.
Ok, I'm using actionscript 2.0, and I am trying to make a scrolling image gallery. I have a movie clip with three layers. the first contains a movie clip used as a scroll bar. The second is a mask used to hide the overflow content, and the third contains movie clip thumbnails. when I click one of the thumbnails, it loads a symbol containing a larger version of the picture over top of the thumbnails on the same layer. My problem is, the large image is added at the very top of the movie clip, even when it is scrolled out of sight. I want it to appear in sight, so the user doesn't have to scroll all the way back up to the top to see it. This is annoying and confusing. Is there a way to do this?
Here is the code I used to create the scroll effect (there is actually a whole lot more to the code but it is very long, so I am not adding it now. I will if it is needed though)(Oh, and there is no text involved in this. I just got this code off a tutorial and I haven't changed the variable names yet)
var scrollUpper:Number = 58; var scrollLower:Number = 309; var textLower:Number = 60; var textUpper:Number = -179; var scrollRange:Number = scrollLower - scrollUpper; var textRange:Number = textLower
I try to code an as3 where I need to duplicate a mc casted from objects, which are loaded from an XML file. My goal is to make a wrap around effects for animated menu icons that use separate swf files.this is the function I try to create, but my concern is in the else statement:
Code: private function onItemLoaded(e:Event):void { loadedItems++; var contentitem:MovieClip = MovieClip(loader.content);
[code]....
in the copyFirst/Last declaration I try to dupe refFirst and refLast... but It seems not to be the good way (error).
ActionScript Code: public function layoutLoad(e:Event):void { FlashConnect.trace("Display.loadLayout()");
[Code].....
It will compile but I get a "Cannot access a property or method of a null object reference." So I am not targeting right. I did double check my instance name is correct and in the root of the loaded SWF
On some sites i have seen usually portfolio or gallery type sites there are thumbnails, text or some shape that you click on to view a particular image. What I'm getting at is some of the sties show visually that the clip has been loaded with change of alpha (images that are not loaded greyed out and ones that have already been loaded are in colour etc..). An example of what i'm talking about is on [URL] When you click on the menu (selection uno), it loads a particular clip, and throughout the session on the site, u can tell which ones have been loaded and have not. I know there are probably many down and dirty ways of achieving this, but i know there is usually 1 or 2 'proper' methods for doing a particular thing.
This reads a php file (which in turn reads a database) and returns a series of years that have content hidden behind them. then the years are placed into a dynamic textbox within a movieclip (yearmarker = "yearmarker"+i).
This all works fine. My trouble is i can't figure out how to add an OnRollOver event to each dynamically added clip telling it to go to its second frame.
On some sites i have seen usually portfolio or gallery type sites there are thumbnails, text or some shape that you click on to view a particular image. What I'm getting at is some of the sties show visually that the clip has been loaded with change of alpha (images that are not loaded greyed out and ones that have already been loaded are in colour etc..). An example of what i'm talking about is onWhen you click on the menu (selection uno), it loads a particular clip, and throughout the session on the site, u can tell which ones have been loaded and have not.I know there are probably many down and dirty ways of achieving this, but i know there is usually 1 or 2 'proper' methods for doing a particular thing
Im creating a booklet with turning pages, like the one previously posted, so all the content is loaded dynamically.On the right hand page i have text, of which some lines are interactive.On the left page, i have a hidden text box. When the user clicks on a certain line on the right page, the text box on the left page becomes visible, and the relevant txt is loaded into the text box.Now, i can make the text box on the left page invisible by placing _visible = 0; directly into the actionscript pane of the text box.What i cant do is make it visible by clicking on the right page text. Where should i put the code to make the text box visible?Is it as simple as movieClip._visible = 1; ?