ActionScript 3.0 :: Using Existing Classes Of Movie Clips?
Oct 18, 2010
I've got 100 instances of a particular class of MovieClip on my stage, and I'm trying to find a way to get functions that affect them all. The obvious way to do this is through their common class, but I'm having a lot of trouble finding out how to do it. Most of the tutorials I've found are about creating custom classes or creating new instances of classes. This isn't what I want to do, as I've already got all my instances on the stage already.
There are actually several things I want to use this for, but I'll just mention one for the sake of brevity.
I want to set the alpha of each MovieClip to 0 when I click on it. Here's the code I'm using for a single MovieClip at the moment:
ActionScript Code:
boxcover1.addEventListener(MouseEvent.CLICK, removecover1);
function removecover1(evt:MouseEvent):void{
boxcover1.alpha=0;
}
While this works perfectly, it means I'm going to have to repeat it 99 times, once for each MovieClip, and later on I need to do some more complicated stuff with it that 99 copies would make near-impossible to pull off. I'm hoping that by using the class ('box_cover') I'll be able to have this apply to every MovieClip on the stage.
Im trying to create a class which can access a movie clip on stage. I've searched many forums/google cant seem to find the solution im after. If i have a movie clip on stage with instance name 'mc1' for example. how can i access this movie clip from a class im creating. Eventually id be able to access the movieclip via a dynamic name but need to get past this simple stage first.
I have created a simple class to change the color of a movie clip on the stage. The movie clip that I want to change the color of has 3 other movie clips nested inside of it. Here is the structure of the Movie Clip
I have a few questions I am hoping to get a few clear answers to. I have been looking around the web and in books for the last few hours and I can't seem to get an answer that is clear, at least not clear to me Question1 If an external class such as a document class is used, you cannot simply access a nested movie clip that has been dropped on the stage from the library using dot syntax, is this correct? Example:
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:
As most of you don't know, I've been creating an rpg game. And, after several tries of art making, etc, I have finally moved back into coding the game. And now, I'm stuck on the equipment system idea. At first, I thought I would just place a bunch of goToAndStop's for each movie clip to go to a frame that has that certain armor piece. This was my first idea for an equipment system. However, after doing some research, and realizing how much lines of code could be saved, I started looking into simply adding and removing movie clips from the character as my new equipment system idea. Now.... on to the problem.
Basic want/ overall achievement wanted: Create an equipment system, which will basically attach movie clips (items) onto characters, which themselves will already be attached movie clips on the stage.
Problem: What is the exact code to do this? And Is there a better way to do this for an equipment system (a less laggy or more efficient way perhaps that I'm not seeing; Check the code below to get a better idea of what I'm talking about)?
Part of the code (or basic idea of code; see comments for extra details
code: //Don't worry I have an OnEnterFrame function here; //attachedObj= the character; figure= the MC name of the character; attachedObj = attachMovie("figure", "figure"+1, 1);
I have multiple movie clips on stage (all in separate layers, of course) as well as buttons on stage to play each movie clip. There are buttons inside each movie clip. The problem is that the buttons inside the top layered movie clip work, but the others in the movie clips below don't.
How would one go about masking movie clips that are nested within other movie clips?
I have a photo gallery slider type of thingy that loads jpegs with loadMovie into containers. I can mask the entire movie clip but as for the containers,...well I just dont know whats going on here.
1. I would like to be able to delete one by one the new movie clips
2. I would like to move them all together.... First you press the word green and then click in the blue area.... A green cyrcle will appear.. Click the word green again and then in the blue square and a new green cyrcle will appear. I would like to move the cyrcles with the buttons arrownd the blue square... And when I press delete I would like to delete any cycle I choose... The flash is too large to attach it to the forum, if anyone is interested I can send it by mail.
I'm new to AS3 and am starting to use OOP in flash. However I run into some problems with accessing movieclips from other classes. I am creating a DocumentClass (like Lee Brimelow showed in one of his tuts) and from that class I want to completely generate the movie using other classes and such. However I run into a problem when I need to access movieclip properties from other classes. Here's an example of what I have:
Code: Select allpackage{ import flash.display.DisplayObject; import flash.display.Stage; import flash.display.MovieClip; import com.dreamline._root.*; public class DocumentClass extends MovieClip [Code] .....
How to add clips from my DocumentClass and access them in the flHandler class without having to forward this.dpStage as a parameter.
Here's what I'm trying to do (in example form): I have a movie clip called "dude". Dude is animated to walk around, then drop a cigar (all inside the movie clip). But the problem is, dude moves, so if you try and move dude as the cigar is dropping, the cigar moves with him. So what I want to do is create a new movie clip instance called "cigar" OUTSIDE of the movie clip dude right as he's dropping it, so that you can move him without moving the cigar. Get it? I've attached another helpful animation to explain.
What I have right now is, on the 13th frame of dude, a few lines of code that create and place an instance of cigar. In that frame I also have an invisible instance of cigar for me to duplicate. Inside of the cigar movie clip is the animation that makes it fall to the ground. I need to change that code so that the instance of cigar is created outside of the movie clip dude. Here's the code I have now (inside of dude, on frame 13):
I have a problem stopping multiple clips. I have created a presentation using flash and I have many movie clips which have sub movie clips inside of them. Ok lets look at one movie clip in detail. Inside one _root movie there are multiple sub movies; each with a different movieclip labels (each movie clip is named with unique labels ie. north, south, east, west, and What I need to do is be able to STOP all these sub movie clips with one stop, and in turn PLAY these same movie clip with a second action.
The only way I know how to stop all these sub movie clips is to target each and every one individually.
What I'm trying to do is have my Flash piece have custom elements set by an XML file. I'm using ColorTransform. I have a piece that's loaded as a separate movie clip, and I can't figure out how to get to the piece and apply the ColorTransform.
Here's one example of what I'm doing for a different element on the same mc.
[code]...
So, in this example, I'm setting header_mc to a color specified in the xml. In the case I'm having trouble with, I want to set a color to a movie clip on the timeline and not the main movie
I am setting up a flash game with seven toggle on/off buttons that all do the same thing.I know how to assign them all to be able to do the same function in the main timeline. What I can't figure out is how to get them all to also do the same function within each of their respective movie clips.
I've been trying to reproduce an animation effect I've seen on the Armani website, but I'm stuck trying to duplicate an empty movie clip with image loaded into it. The duplicates exist and I can move them, but they are invisible. Since the duplicates reside on depths above the intitial clip I'm confused about why they are invisible. The duplicates are scripted to follow behind the initial clip - each offset by 30 pixels (though I don't have that working perfectly).
okay, i'm trying to create a full website myself, and inside my main scene movie, i have a movie clip for the content.. inside THAT clip on a frame for the links, i have another movie clip that has all the link buttons embedded... i've got those buttons set up so they stagger fade in as an effect... my problem is, they just keep repeating, and i want the fade in effect to stop after the first time. i've got a stop keyframe after the tween of every button motion, but i dont know the correct code for the movie/button clip itself to play once and then stop.. this is what i have right now, as an action on the movie clip with the buttons inside it:
i'm trying to create a full website myself, and inside my main scene movie, i have a movie clip for the content.. inside THAT clip on a frame for the links, i have another movie clip that has all the link buttons embedded... i've got those buttons set up so they stagger fade in as an effect...
my problem is, they just keep repeating, and i want the fade in effect to stop after the first time. i've got a stop keyframe after the tween of every button motion, but i dont know the correct code for the movie/button clip itself to play once and then stop.. this is what i have right now, as an action on the movie clip with the buttons inside it:
onClipEvent (enterFrame) { play(); }
also if you want to see what the problem is, here's the website in it's infancy (700k)
I am updating a movie created by a previous employer. It involves screen shots and voice overs. There is a navigation bar at the bottom with scrubber, stop, next, etc.
I named the new screen shots the same as the old ones and imported them and everything works fine. But this doesn't seem to work with the voice overs. As soon as I save over an old mp3 with the new one, the nav bar no longer works.
I am placing a movie clip in the swf by AS. In the resulting swf, It's hiding the buttons that are already on the stage. How do I get that movie clip to be behind other elements on the stage?
Here's the background and details: In Flash CS4, I have existing "Forward" and "Back" buttons on the stage, frame1 of the topmost layer Artwork, placed manually, nothing else on the stage. I made a movie clip and it exists in the library but is not on the stage, it's called up via AS, which is in frame 1, actions layer (the layer below the artwork). [code]....
If I already have an existing movie, what is the best way to add a preloader to this movie?I have 1 frame with a few layers right now. Then, I have some movie clips on frame 1 Should I just move everything to frame 2? Does that throw anything out of sync? I am using labels in the movie clips that that I can use gotoAndPlay("label");
I'm trying to open a new window from a button in my main window and load a movie clip into it. I have not yet found a solution that works though. From the documentation I have found and tried:
Code: loadMovie(filepath, this);
This works, but it replaces my existing one. I want a new window, so I tried to add:
Code: this.createEmptyMovieClip("chat_mc", 999);
This loads all the components from the movie clip ontop of my existing one, it gets it half way there sort of, lol. All in all this is what I have:
Code: on (release) { this.createEmptyMovieClip("chat_mc", 999); loadMovie("C:\Documents and Settings\foo\Desktop\Server.swf", chat_mc); }
how I can get this to work? I would like two windows with two movies, the new one created on the press of a button.
I've created a fullscreen Flash .exe. I want to be able to build a button that can allow you to close the exiting movie and open a new one (kinda like Lingo's OpenMovie command). I'm sure there's an easy way to do this in AS, I just can't find it.
I have a PNG imported into my library and exported for use in Action script. On the stage, I have a swatchFill movie clip.Currently I have code that will transform the fill to a solid color, however I'm getting into metallic swatches and the colorTransform function will no longer work.[code]
I Have 3 Movies:MAIN.SWF, contains loading movie actions for Nav.swf and Home.swf.NAV.SWF, contains navagation menu loaded on Level 2 in Main HOME.SWF, contains slideshow for home page loaded on Level 1 in Main In NAV.SWF, there is a MOVIE CLIP "graphmc", which contains a BUTTON "graphicbtn", When this button is clicked, I'd like the HOME.SWF (which is loaded into Main.swf on Level 1) to fade out and unload, and load and fade in Graphics.SWF in place of it.