Basically I'm working on a new game and have decided to come up with the idea of having different enemies - however would I have to create multiple symbol's for these enemies or can I use that one symbol and change the image that is loaded onto it?
If yes - how would I go about doing this?
Currently the symbol is known as Enemy
Your symbol must be movie clip. In each frame there are different images and added by label. to change the enemy you can call:
Enemy.gotoAndStop(labels)// use Enemy.gotoAndPlay(labels) if you want the animated ones.
with labels is a string.
Related
I am using Flash CC.
I have drawn 7 rectangles using the Rectangle Tool.
I then converted the 7 as one movie clip (By hitting F8).
The Problem:
I want to be able to iterate through these shapes and move each individually.
However the 7 rectangles seem to be encapsulated into the ONE shape and I can't access them.?
If I use .numChildren on the movie clip, it returns 1.
If I use .getChildAt("anything > 0") its a null reference exception.
Please help,
I don't understand how this is so difficult.
I have searched for ages to find the solution to this and for the life of me I can't.
Thanks in advance.
(P.s) Instantiating the rectangles in code works, but I need to be able to do this via Flash CC as I will be importing artist material for manipulation.
Your best choice is to make every shape in your made movie clip a movie clip as well.
In Flash go into your made MovieClip (I will call it containerMC for easier understanding) and make every shape a MovieClip by hitting F8. You can also give them instance names, if you want, just make sure they're unique.
Then your containerMC will return numChildren value 7 in your case.
You can move/access your shapes in the containerMC via getChildAt(), or by using their instance names that you've provided via containerMC.instance1 or containerMC["instance1"].
I am working on flash professional cs5.5 and actionscript 3. I need to use symbols of customized sizes to test the hitTestOjbect() function. However, when i convert the bitmap to a symbol, by default it goes into a rectangular size and the empty space all around is also detected as part of the symbol.
Is there any way to keep the size of the symbol customized ?
That is the nature of a bitmap. Technically, bitmaps are always rectangular. Transparent areas are just fills with alpha-0. When you convert a bitmap to a symbol, the bitmap still exists, just inside the context of the symbol.
One of the fastest ways to fix this is to use a mask inside your MovieClip. Create a plain drawing object in the exact shape of the hit area you want. Then, place that on your timeline on it's own layer. Right-click the layer with the mask, click "Mask", and then drag the bitmap's layer under the mask one. Lock both layers, and exit symbol editing.
Now your hit area will be limited to only the masked area.
EDIT: I appear to be mistaken - hitTestArea is always rectangular. See the top answer to hitTestObject Collision Not Registering Correctly.
I've gathered all game pages on different frames of movieclip called game. in that game movieclip there are 4 different frames. on third frame I have some drag & drop functionality. When I drag one item, I want it to be on the front, I mean all other objects on that frame must not block the view of current dragging object. I used this.setChildIndex(currentDraggingObject,this.numChildren-1); but the problem is whenever I drag objects, when I change the frame, those objects are shown on that frames as well.
In short description: When I set an object's Index in MovieClip(game) , that object is seen in each frame of MovieClip(game) , how can I fix this?
I've searched the result online but couldn't find a solution.
Thank you
-Ozan
Instead of this:
this.setChildIndex(currentDraggingObject,this.numChildren-1);
You can simply use this:
this.addChild(currentDraggingObject); //shorter and clearer
If you have some object on a frame and you actually add it again, it indeed stays there in the other frames (I found this out too). The best/fastest solution would be to simple remove them before you are going to change the frame with this.removeChild(object)
How do i get my UILoader to play a .swf file once then disappear until called upon again?
I am creating a guitar tutorial app that shows you chords and the transitions between them. to display the chords I'm using standard Flash graphics and for the transitions i am using a UI Loader to display the .swf files for instance, on the C chord frame, the fingers are in position and the UI Loader is a layer on top of it, when the chord transition is selected from the list component it loads the chordtransition.swf.
The problem is that once the swf is loaded it plays on loop, ive added "stop();" in many different places as people suggest and it doesn't make a difference.
I would like to be able to click "C-D" on the component list then for the .swf to play once then disappear.
Any ideas??
A strategically placed stop() should work (last frame on the timeline in the swf). You'll need to stop the right movieclip - if your movie has nested clips you might be stopping the wrong clip.
However, creating multiple swf's just to show different chords looks like overkill to me.
Create clips showing all chords on the main timeline, and add frame labels to indicate where they start and put stop() at the end of every chord animation (are you using animations?).
Use movieclipWithChords.gotoAndPlay("chord_C");
If you are not using animations you can use movieclipWithChords.gotoAndStop("chord_C");
Of course you can also create labels like 'C' and 'D', and use those as a direct mapping of the chords.
Update: After reading your question again I realize you are actually showing clips of a transition from one chord to another. In that case you can still use my suggestion as above, only your labels will not be for the individual chords, but for the chord transitions e.g. 'transition_C-D' or 'transition_G-B'.
I have these 2 separate FLA (AS3) files and I want to merge them together. One FLA, let's name "Animation.fla", consists of a 1-frame animation with a class assigned to its main stage, let's label it "MainStage.cs." The other FLA file, label it, "Navigator.fla", consists of 3 frames where I have to navigate different frames to get to the animation on the Animation.fla.
I have tried nesting the two but I gain errors when trying to convert the whole Animation.fla to movieclip and put it on the frame of the Navigator.fla. It's seems it's not the correct way to do it.
Please fill me in with ideas on merging animations with Classes since I'm still new to this.
I have tried nesting the two but I
gain errors when trying to convert the
whole Animation.fla to movieclip and
put it on the frame of the
Navigator.fla. It's seems it's not the
correct way to do it.
This is one way to do it. It could be that your code has errors. Please post your code.
In the meantime, check if:
-your MovieClips have instance names
-you are referencing your MovieClips correctly in your code.
You could you create a new movieclip on the stage of Animation.fla and select all of the frames in Navigator.fla, right click and "copy frames". Then go back to Animation.fla and paste them into your new movieclip. This will work if you don't have a main class in Animation.fla.