ActionScript 3.0 :: Attach Different Movieclips With One Function?
Apr 26, 2010
I'm adding movieclips from an external .as class called GUI. But what I'd like to do is be able to load multiple GUIs - lets say GUI0, GUI1 & GUI2 - through the one class using a dynamic variable. So if I need to load a certain GUI i can just instantiate the GUI class and run newGUI.loadGUI(GUIname); and have it load the correct movieclip based on the variable.So, syntax aside, it would look something like this:
Code:
loadMenu(GUIname) {
GUItoLoad = GUIname;
var mcLoader:GUItoLoad = new GUItoLoad();[code]........
I've tried a few different things syntax wise, and have had a search and browse, but have come up empty handed.
I'm adding movieclips from an external .as class called GUI. But what I'd like to do is be able to load multiple GUIs through the one class using a dynamic variable. So if I need to load a certain GUI i can just instantiate the GUI class and run newGUI.loadGUI(GUIname); and have it load the correct movieclip based on the variable.
is it possible to attach the same movieclip twice?for example i have two buttons and both attack Main_Page however when i test the flash and error reads "Duplicate function definition"is there a way of attaching the same movieclip more than once? im using this code to attach the movie but when i add this code twice on two buttons duplicate error shows:
s_next.addEventListener(MouseEvent.CLICK, attachMovieclip); function attachMovieclip(event:MouseEvent):void {var addPage1:Page1 = new Page1();addPage1.x= 0 addPage1.y= 0addChild(addPage1); }
s it possible to attach the same movieclip twice? for example i have two buttons and both attack Main_Page however when i test the flash and error reads "Duplicate function definition" is there a way of attaching the same movieclip more than once?
im using this code to attach the movie but when i add this code twice on two buttons duplicate error shows:
s_next.addEventListener(MouseEvent.CLICK, attachMovieclip); function attachMovieclip(event:MouseEvent):void { var addPage1age1 = new Page1(); addPage1.x= 0 addPage1.y= 0 addChild(addPage1); }
i have an error in my game project. i am trying to attach 5 different movieClips in an Array.but i dont want these movie clips to be appear on the stage when i attach these. but these movie clips appears on the stage as soon as loop executes.
here's the code:
var terrorists:Array = new Array(); for(i=1;i<=5;i++) { var terrorist:MovieClip=attachMovie("terrorist_"+i, "terrorist_" + i, i); terrorists.push(terrorist); }
I have used AS2 for a long time, and have decided it is time to start working with AS3. When attaching multiple movieclips with instance names I would normally do this (AS2)[code]...
I have a problem with attaching more than one movie clip to this control structure, I need to attach 8 different movieclips. Till now the code attaches only one mc the "window". windows = 8; for (c=1; c<=windows; c++) { attachMovie("window", c, c); }
I was screwing around one day and thought I'd make a little line-drawing-thing. Basically it just attaches movie clips and draws lines between them using the drawing API. That was the easier part. Now I though I'd take it a step further and add some curves. I tried but the attached file is the best I could think of.
square.fla is the original file lineCurve.fla is the file in which I tried to add curves.
I am trying to attach a movieclip and make rows with 3 movieclips each. I can attach the moveclips and make space between them but i cant figure how i can make rows...
here's the code
Code: var gamesData:XML = new XML(); gamesData.ignoreWhite = true; gamesData.load("xml/games.xml");
I have a mc (changeColorMc) and three movieclips. The three movieclips are created on the fly (so there could be more movieclips) and filled with a color from an Array. This works fine.
Now I want to add an eventlistener for each movieclip, so when someone push one of the movieclips the movieclip with the name "changeColorMc" gets that same color from the colorArray.
My question is: How can I pass the color value from the colorArray to the buttonPressed function? Is this possible?
I was also thinking that I had to create three buttonPressed functions ie. buttonPressed1, buttonPressed2 and buttonPressed3 and attach these to the created movieclips.. but how? Because I don't know up front how many movieclips there will be..
point me to anything which will help me dynamically attach movieclips from the library into one main movieclip, which then I can duplicate it many times..You see, what happens with duplicateMovieClip,is that it duplicates the main movieclip itself, without taking its contents..I want to take the contents too. The only way I can imagine this could work, was if I could take a 'snapshot' of the movieclip and keep it as a bitmap, from which this could be duplicated - because I dont need the movieclip and its contents to contain code or have any animation playing. I just want it as an image, so I can create a pattern from..
I've a movieClip called "picChange" and inside that movieClip, there is another movieClip called "picFrame" and inside that movieClip there are three movieClips called "HolderL1", "HolderL2", "HolderL3". I use these 3 movieClips to attach movieClips(questions for game) from library. I put movieClip inside movieClip to add some animation while it loads. I used following code:
for(var i:int = 0; i<3; i++) { var pic_mc:String = "picLeft" + ranque[i]; var que_mc_class:Class = getDefinitionByName(pic_mc) as Class;
I am trying to attach a movie to the swf when a function gets executed. Everything in the function except this is fine, but the movie is not attached. I used this line to attach the movie.
i am aiming to display an alert when the user hovers over the form in fullscreen mode only. When the user is in normal view nothing appears. I have listed the code i am using but nothing seems to happen.
[URL] - which works fine on start, but I want to attach this function to only start on certain words at a certain event action. With what I got can anyone see how I can stagger the function to a specific event? Here is what I have so far, which starts the letter cycling, but it ends on the first letter and does not complete the full word:
I Have been using Kirupa for a while now, an excellent resource!! but have only just joined the forum. I have had a look at various Flash tutorials provided on the site but cant seem to find quite what I am after. I have a contact form on a site I am making and I want to be able to browse and add an attachment. I see Kirupa provides a tutorial on contact forms and one on uploading files to a server with flash but unless I am mistaken not a contact form with an attach facility? I would like the attachment to be send directly to the e-mail address along with the other information. I am using CS3 but have published the swf with AS2.0 The site is [URL] if you need to see what I'm talking about to make it clearer - once there click on contact
I'm doing a basic site with frame labels on the main timeline whose name corresponds to the btn names. A simple otoAndPlay(evt.target.name); I have a basic navigation setup of 7 mcs with mouse eventlisteners for CLICK, ROLL_OVER and ROLL_OUT.
Does anyone know a better way to do this so when my mcs are clicked they display the rollover content/art? In essence I'm trying to achieve that when the user clicks a btn it goes to that "page" and the corresponding btn stays highlighted. Pretty standard web navigation technique but I just don't know what the best way to do this in flash is and with how my site is setup.
how to eliminate previos attach before move to next attach MC..let say as u can see in my code..I just settign the interval..for 2 second..in other to attach the mc on eby one...so how to set up the code so that if the 2nd mc has attach it'll remove the 1st one attach for certain time...and so on..the scenario like this..
mc1 attach after 2 second mc2 attach --> remove mc1 after 2 second
I ve used next script: onClipEvent (load) { if((_root. mc1._visible=true) and (_root.mc2=true)) { _root.mc3._visible=true; }else{ _root.mc3._visible=false; }}
To achieve next: mc3 is visible only when mc1 and mc2 are visible else its hidden, but this dont work, with this script on load all clips are visible on stage mc1, mc2, mc3, inspite there is a script which is hiding mc1, and mc2...(they should appear on stage on mouse event and this was ok before a inserted script from beginning of post, now they are always visible). How should I write this to make mc3 visible only when mc1 and mc2 are both visible on stage.
trying to use a function on 7 movieclips..wrote it all down with 7 individual EventListeners..but it can be much easier.Tried this, but that won't work..trowing me an error:
TypeError: Error #1006: hitTestObject is not a function. at new_fla::MainTimeline/endDrag()
ActionScript Code: import caurina.transitions.*; var cirX:Number = 60; var cirY:Number = 60;
[code]....
So I've got 7 movieclips named Object1, Object2....Object7, and when I click on one the movieclip has to stick on the mouse and if it is released nearby the target movieclip it has to stick to it. If it is not nearby it has to go to a random place..
All works fine like this:
ActionScript Code: import caurina.transitions.*; var cirX:Number = 60;
I have 3 movieclips on my main timeline - 1 MC for each frame. The movie clips are named image1_mc, image2_mc, image3_mc. I want to have all 3 mcs have this code on them:
Is there a way how the startDrag function can be used on 2 different movie clips on one stage?
I have my own photo slideshow player (photos + music) and I need 2 dragable movieclips (buttons). First one is on the timeline and second one on the volume slider. How to achieve that I could use the startDrag function on both of them in the same time?
Or is there any trick how to do it? A regular youtube player has 2 dragable buttons (volume, timeline) also...
I am creating an interactive map which is attached, what I want when you hover over any movieclip the alpha decreases and when you mouse off it goes back to 100% aplha. I can certainly do this, but I only know how to do it by referencing each movieclip first! For example: