ActionScript 3.0 :: Objects On Timeline Reset Themselves On Loop

Dec 3, 2010

I have a character whose face I'm trying to change. The face is a Bitmap object that gets loaded at runtime and placed into the characters face holder movieclip.

I'm loading the Bitmaps just fine, but there is a snag.

The character has many animation states, each of them is a movieclip that lives in it's own frame in the main character movieclip (so that each frame is an animation state).

The problem lies in that the face holder movieclip is inside each state animation movieclip, and it itself is animated along with the character (it's a face, it has to move along too...)

On each state movieclip I have an instance of the faceholder placed on the timeline, and from the character class I can access it by going this.mc.face (where 'mc' is the current state movieclip -they're all structured the same way and have the same objects inside)

So, after I load my image for the face, I'm going like this:

this.mc.face.addChild(faceImg);

this does load the face into the faceholder, and it stays there for a while... until the timeline loops back and the instances reset themselves.

So, I'm kinda stumped here... and feeling rather stupid since this should have been simple... How can I keep the faceHolder movieclip from resetting itself when the timeline loops?

To make things worse, I've realised that the faceholder resets itself not only at each timeline loop, but at each keyframe...

I don't think running a function on EnterFrame just to keep placing the face there again is a good idea... (sounds like disaster really) but then again, it might be the only way, since each state movieclip has it's own set of keyframes :P

EDIT: I just tried the above idea of replacing the image on each frame, but even that doesn't work... the face flickers with a null object error at every loop... go figure why... the face holder movieclip has a motion tween that spans all the range on the timeline... it never gets replaced by a blank frame.

View 2 Replies


Similar Posts:


ActionScript 2.0 :: Reset Machine Like When This Never Ending While Loop?

Jun 16, 2009

How to reset machine,like when this never ending while loop, is running,and flash is stuck?I mean I should gain back control.

View 2 Replies

ActionScript 1/2 :: Flash Timeline - Play / Pause Button Does Not Reset

Apr 9, 2009

I am using Flash CS3 and ActionScript 2.0. I have a flash timeline that shows 4 tabs and cycles through them. There is also a play/pause button. My issue is that when you click one of the tabs, you start the timeline up again, but the play/pause button doesn't reset. I have the full Flash file, as well, if needed. [URL]
Attachments: TabbedFlash10.swf (52.7 K)

View 6 Replies

Flash :: Check And Reset Variable On Main Timeline From Inside A Movieclip?

Feb 11, 2010

I'm converting an old AS2 file into AS3 (and trying to learn AS3 at the same time).A movie clip contains a number of different animated sequences and buttons within the application trigger these different sequences.The buttons are functional only when an animation has completed playing.

In AS2, I achieved this with a var called _root.animating which was initially set to "false" and switched to true when the animation played and switched back to false at the end of the anim sequence. The buttons checked this var when clicked. Here is some of the AS2.[code]...

View 2 Replies

ActionScript 3.0 :: Loop Through A Display Object And Reset Their Children's ChildIndex Based On Their Y Value?

Sep 5, 2009

Would it be possible (Without being extremely inefficient) to loop through a display object and reset their children's ChildIndex based on their y value?

View 1 Replies

ActionScript 3.0 :: Reset The Display By The Means To Start The Motion All Over Again (reset Button)

Jul 13, 2010

Just new in forum and just new in as3 programming. All i want to do is to make some physics simulations (i'm physics teacher...). So i made my first sim with the following code, just to simulate a simple motion with constant velocity. It works ok, except the part i need to reset the display by the means to start the motion all over again (reset button). Then the motion starts but the traces of the previous motion remains on stage. I tried the null command (sp=null) but the sim could not start again because the sp nedded to be non-null...

[CODE]...

View 2 Replies

ActionScript 1/2 :: Make A Reset Button And Add Script To It To Reset All Of The Drag And Drop Movie Clips?

Apr 13, 2011

I have an issue with adding a reset button to my drag and drop movie clips.The problem is, if a student drags a movie clip to a wrong location on the SWF file I want them to be able to hit a reset button that would take them the same SWF that they opened and what would showup would a clear page for them to restart their drag and drop exercise.I know how to make the button for this just want the proper action script to be able for user to start over with no movie clip symbols on the page.

View 3 Replies

ActionScript 3.0 :: Bg.reset() Can Only Find Reset Used For Timers?

Dec 28, 2010

reset in google yields only its use for timers.However I have code bg.reset() which I suppose puts the background back to the beginning of its timeline.

View 3 Replies

ActionScript 3.0 :: Creating Loop In Timeline?

Oct 21, 2009

My master timeline is 128 frames long, I want the timeline to play from frames 1 to 128 once and then from frames 64 to 128 three or four times before returning back to frame 1 and starting the whole sequence again so I end up with a continuous loop that consists of the full animation once and the second half 3-4 times all repeating endlessly. I've been reading about "for" loops and guess this is what I need to use but I don't quite get how to set it up, how I'd set up a counter to count the repeats, and how it would reset etc.

View 5 Replies

ActionScript 2.0 :: Loop Code Not Timeline?

Dec 4, 2009

I'm creating a simple banner for my site. I found some cool landing confetti code but it seems like after it hits the keyframe with the confetti actionscript it stops and the rest of my simple timeline animations don't play. I just wanted to have a few type animations and a logo fade in and out while the confetti is falling. I removed the stop on the confetti frame and after I do that the animations play but the confetti doesn't work. This code is on the main timeline that causes it to stop

Code:
// pause after how many seconds
vSeconds = 11;
vFPS = 20;

[code]....

View 6 Replies

Creating Loop To Set Color Objects?

May 8, 2009

I'm trying to create a for loop to set the color objects outlineColor1...100 to the value defined in variable _root.outlineCol. Everything works fine when I set the color to these objects via 100 lines of code but I'd like to replace them with a for loop of course. I suspect the syntax in the first part of the second line is incorrect but I'm not sure.

for (var i:Number = 1; i <= 100; i++) {
outlineColor[i].setRGB(_root.outlineCol);
trace(i);
}

View 2 Replies

ActionScript 3.0 :: Removing Objects Without Using For Loop?

Jul 10, 2009

i am having a problem removing objects from the stage and their associated arrays. basically when a "shark" is added to stage i want all "cans" to be removed and i dont want any "cans" to be added until the shark has left.my problem comes as i dont want to keep using for loops as i already have two or three for "cans" alone and i heard thats not good for the code!

Code:
var canTimer:Timer=new Timer(2000);
canTimer.addEventListener(TimerEvent.TIMER, addCan);
canTimer.start();

[code]....

im not 100% sure were to put this in my code-i didnt really want to put it in a function of it's own as it would mean using another for loop?i get a output error when a shark is added like this:

Quote:

TypeError: Error #2007: Parameter child must be non-null.
at flash.display:isplayObjectContainer/contains()
at dolphinmoviegame_fla::MainTimeline/canHitTest()

even though all "cans" are removed.

View 1 Replies

ActionScript 3.0 :: Using For Loop To Get Objects X Position?

Nov 5, 2009

I have 4 objects that I all want to have their own velocities. I have a bunch of variables (each one has a different value):
PHP Code:
public var vx1:Number;public var vx2:Number;public var vx3:Number;public var vx4:Number;

Rather than having a function for each object to say:
PHP Code:
function1 { this.x = vx1}function2 { this.x = vx2}function3 { this.x = vx3}function4 { this.x = vx4}

I'd like to have a for loop to have my objects x position to += vx(1 through 4):
PHP Code:
for (var i:Number=0; i<5; i++) {
this.x += (vx+[i]);
}

So I tried the above with a combination of " " around different parts of (vx+[i]) but I realized that turning any of it into a string means 'this.x' cannot read it because x has to be a number not a string. So how can I make this.x = vx1 then vx2 and so on with a for loop?

View 2 Replies

ActionScript :: Duplicating Objects In A Loop?

Dec 15, 2010

The follow code produces a strawberry image that falls from the top of the screen to the bottom. I tried using a for loop to create 10 different instances of this but it doesn't seem to work for me.(Note: ranx is a number produced randomly earlier in the program)

Code:
var nstrawberry:strawberry = new strawberry();
stage.addChild(nstrawberry);
nstrawberry.x = ranx;

[Code].....

View 2 Replies

ActionScript 2.0 :: Creating Objects In A For Loop

Apr 4, 2007

This piece of code gives me an error because i have an equation on the left side of the equal sign, logically it makes sense, but flash doesn't like the code how would i do some thing like this?[code]

View 2 Replies

ActionScript 3.0 :: Using A For Loop With Hittest Objects

Apr 19, 2012

I'm trying to get something quite simple to work, but can't figure out what's happening here. I have five identical MCs (Bat characters), and the user can drag a bottle to feed them.

There is a hittest object (called WormEat) inside the bat's head. When the bottle, which is attached to the cursor touches the bat's head, it toggles to frame 2 of the bottle, which should play an animation of the liquid going down to empty.

This code is all working fine, except that when the code toggles to frame 2 of the bottle, it remains static. The animated Movie Clip doesn't play.

If not, perhaps a Switch statement could work, but I'm not sure how to use that method with Hittest..

Code:
var DragArray:Array = [Bat1, Bat2, Bat3, Bat4, Bat5];
for (var i:int = 0; i < DragArray.length; i++) {
DragArray[i].addEventListener(Event.ENTER_FRAME, CollisionWorm);

[Code]....

View 14 Replies

ActionScript 1/2 :: Move All Objects In To ONE MC In The Main Timeline?

Aug 10, 2009

On the main time line I've got movie clip called Z and also n the main timeline I've got another movie clip called B. Inside B I've got a movie clip called C. My problem is - the actionscript written in C makes few objects in the main timeline function (changing colors, displaying notes, input text linked with dynamic text, etc...). I need to move all those objects in to ONE MC in the main timeline (changing colors, displaying notes, input text linked with dynamic text, etc...). But when I move it in to a single MC it wont function! simply the actionscripts won't work!! What should I do to make all those objects in to one mc and still make the actionscript written in C work? p.s. - I've used the _root. command in C.

View 2 Replies

ActionScript 3.0 :: Timeline Loop - Trace Does Not Work

Aug 27, 2011

I've got something simple in my main time line. I know I must be missing some kind of loop function, as the hold down doesn't work unless I keep clicking. And my trace doesn't work unless it starts on the 'enemy'. I'm just not sure what

Code:
import flash.events.MouseEvent;
_left.addEventListener(MouseEvent.MOUSE_DOWN, moveLeft);
function moveLeft(e:MouseEvent){
_hero.x--;
[Code] .....

View 6 Replies

ActionScript 3.0 :: Can't Unload FLV Called To Timeline Loop

Jun 5, 2010

So I tried to use quicktime but flash CS4 no longer accepts it. All day yesterday I've been working with a .flv version (which doesn't look nearly as good) and tried to directly import it but got an error ("no such file exists") even when it's right next to the other files.

With the Wizard I tried both picking the local file and assigning the URL of the file previously uploaded to my site.So i then tried to use actionscript to load it into the actions layer on the frame at the beginning of the "game" scene which after hours of fiddling finally worked.

I just want it to loop until someone clicks to go to another section but now what happens is the video and sound from the .flv keep playing even after you click on another button to navigate away from this scene.

I tried online to find a way to unload the .flv but none of them worked - went thru pages of google searches but the suggested coding did not prevent the .flv from unloading.

var vid:Video = new Video(480, 320);
vid.x=231;
vid.y=457;

[code]....

View 0 Replies

ActionScript 2.0 :: Replace A Timeline Loop With A SetInterval

Sep 24, 2005

Trying to replace a timeline loop with a setInterval. For some reason, the function I am using to duplicate my movieclips is not working from setInterval but does work from a normal function call. Why would this be??? I know the functions is actually being called because I traced it. But the duplication of the ball does not.

birthBall = function(){
ball.duplicateMovieClip("ball"+_parent.counter, _parent.counter);
this["ball"+_parent.counter].colNumber = random(4);
this["ball"+_parent.counter]._x = _parent.column[this["ball"+_parent.counter].colNumber];

[code]....

View 3 Replies

IDE :: Loop To Keep Playing Regardless Of The Timeline Stopping And Starting

Apr 29, 2009

i just want my loop to keep playing regardless of the timeline stopping and starting. is this possible?

View 1 Replies

PHP :: How To Retrieve And Display Array With Objects Using Loop

Jun 30, 2011

In a Flex project, I have an array with objects in it. I want to save this array in a cell on a mysql table along with some other basic info like title, and an id. How to echo all the rows... I'm trying to echo the contents of an array that was serialized and placed in a single cell. This array has objects in it. So, I have this code here to serialize the array, and insert it along with the other info into my DB:

function submitLogDbObj($array,$id,$title) {
$title=mysql_real_escape_string($title);
return mysql_query("INSERT INTO logs (text,id,title) VALUES ('".serialize($array)."','$id','$title')");
}

Then for a test I'm trying to make a loop that will display the log in a way that looks like a conversation... An object in my array would look something like:
[1]
icon = ""
msg = "this is a test"
name = "Them: "
systemMsg = 0
[Code] .....

View 3 Replies

Actionscript 3 :: Loop Through / Count Number Of Objects?

Nov 21, 2011

Why does trace(length) return 1? I expected it to be 3.

How would I loop through each screen object?[code]...

View 1 Replies

ActionScript 2.0 :: Create Color Objects With A For Loop?

Apr 29, 2010

I have this code to change the colors of some movie clips[code]...

Since I have lots of buttons, I wanted to consolidate this code into a For loop.

View 0 Replies

ActionScript 3.0 :: ENTER_FRAME On Objects Vs LOOP Performance?

Jun 8, 2010

So for my current project I am to handle A LOT of objects on the screen. Which made me wonder what approach I would go about the ENTER_FRAME event.I have 2 samples below, one where my BulletControl object calls on every bullet object's 'FrameFunc()' in its own ENTER_FRAME event with a for loop.The other sample every object has its very own ENTER_FRAME, so it works independently.

[code]....

Also for each burst of bullets I create about 50 objects or so; a lot of object instantiation is never good with such a short interval which makes me wonder if the garbage collector has a hard time keeping up.

View 1 Replies

ActionScript 3.0 :: Access Objects Created In A For Loop?

Jan 21, 2011

I need to be able to make a large amount of concentric circles, using only the action script. I need to be able to alter each of these concentric circles independently from each other. Currently My code is as follows:

ActionScript Code:
var circ1:MovieClip = new MovieClip();
addChild(circ1);

[code].....

View 6 Replies

ActionScript 2.0 :: [F8] Using A For Loop To Place Several Objects On Stage

Oct 7, 2006

I've been working on this for over 3 hours and it is about to drive me crazy! I was one of those people who never paid attention to math in high school because i thought i would never use it ( i knew i wanted to be an artist/designer of some sort). But now of course, that attitude is coming back to haunt me. I'm using a for loop to place several objects on stage. I need a formula that will space objects along the x axis evenly, and center all the objects on the stage. Kinda like if you use the align panel in flash to distibute the vertical centers of several objects to the stage, if that makes sense. If there is only one item, it should be directly in the center of the stage. If there are 2, it should place them in the center of the 2 halves of the stage, and so on for howeve many objects there are. I also want a buffer of about 25 pixels on either edge of the stage so that no object is ever on the very edge of the stage. I made a simple diagram to illustrate:

View 5 Replies

ActionScript 3.0 :: Foreach Loop Through A 2D Array Of Objects?

Sep 2, 2010

I am used to C# and XNA, where its very simple to go through all objects in a list or array.

I am trying to make a tile map, and have a 2D array of TileObjects.

how do i make a loop that goes through all object?

View 5 Replies

ActionScript 3.0 :: Adding Objects To Main Timeline With Code?

Jan 13, 2011

I need to find out how i can add those same movie clips on the main timeline with code..So i need to figure out how to take objects from the library and add them on stage (main timeline) using code..

View 8 Replies

Actionscript 3 :: Objects Coordinates Relating To A Frame On A Timeline

Mar 16, 2012

I am looking to create an animation (perhaps frame by frame) that corresponds with the coordinates of an object. Specifically, I want to have a draggable object's coordinates (locked to the x-axis) indicate where the playhead of a specific movie clip should be. In other words, let's say that I have a 100px wide stage and I want each px location of an object on that stage to correspond to a particular frame of a movieclip. In concept, I feel that it should be as easy as loading an objects coordinates into a variable, then passing that variable on with a simple math equation, adjusting it for movieclip length... but right about then my brain gets fried. Finding out how to lock a draggable object to the x-axis has been pretty easy, but from there I'm stumped. I'm not particularly well versed in AS3 but I do like to think I understand the concepts.

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved