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
Similar Posts:
Jun 10, 2009
why the timeline inside these movie clips and the timeline on the main scene have to correspond to work. [URL]
View 1 Replies
Mar 9, 2010
I have 20 players in a game and cutting and pasting lots of code except for a few numbers. I have future features that would require over 400 lines of mostly repeated code. So I learned how to use "for", and practiced with a trace command. Traced the results exactly as I thought. However when I apply it to the guts of my function, the movie breaks down. I suspect it's because the function is being called on an EnterFrame command and the for loop I wrote is being executed over and over.
This works when I hand code:
Actionscript Code:
function drill(){GUESS0 = ((guess0min * 60)*1000) + ((guess0seconds * 1000))
GUESS1 = ((guess1min * 60)*1000) + ((guess1seconds * 1000))
GUESS2 = ((guess2min * 60)*1000) + ((guess2seconds * 1000))
GUESS3 = ((guess3min * 60)*1000) + ((guess3seconds * 1000))
GUESS20 = ((guess20min * 60)*1000) + ((guess20seconds * 1000))
//and then 300 more lines of other code}
And then a button later calls this when pressing:
Actionscript Code:
my_MC.onEnterFrame = function(){_root.drill ();
//so _root.drill is continually being called, which is good, because it has all sorts of data that needs to be refreshed, but I think it's screwing with my "for" loop.}
And the following is NOT working.
Actionscript Code:
function drill(){for (i=0;i<20;i++){
"GUESS"+i+" = ((guess"+i+"min * 60)*1000) + ((guess"+i+"seconds * 1000));";}
But when I trace it in a separate test movie, it outputs exactly what I would hope it placed in the code:
Actionscript Code:
for (i=0;i<5;i++){trace("GUESS"+i+" = ((guess"+i+"min * 60)*1000) + ((guess"+i+"seconds * 1000));");}
So at the end of the day, I guess I can trace these results in a test movie and use it to generate what I need, and cut and paste it into the project... but I thought 'for' loops were for saving time AND space. Am I using this code right? Maybe my use of "", or +, or i is misguided?
View 4 Replies
Apr 12, 2011
I want to get some flashVars parameters, but have a hard time getting them into any variable.
When using the following code :
[Code]....
the values are shown inside the SWF as expected. However, when adding a trace in the for loop, nothing is there.
Why is this, and how should I retrieve the variables?
View 6 Replies
Sep 19, 2011
For some reason trace does not work on when I put trace into my ActionScript files. I use the Flex SDK to build Adobe Air applications. I am currently on Flex SDK 4.5.1 and Adobe Air 2.7.I have checked that idl is not running, can't find a trace of it ( pun not intended ).I have also added mm.cgf to ~/Library/Application Support/Macromedia, that hasn't worked either.
Update: create basic HelloWorld.mxml
<?xml version="1.0" encoding="UTF-8"?>
<s:WindowedApplication
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
[code]...
But it still doesn't work. Provided the code, that by some weird chance it could be the app.
View 1 Replies
Jul 1, 2004
hive just started actionscripting instead of tweening so be gentle. i use mx 2004 but i cant get the trace function to work.., here is the code form a kirupa tutorial...
_global.myvar=5;
trace (_global.myvar);
why does this not work?i thought it shud display 5.
View 2 Replies
Nov 3, 2010
I was wondering if it was possible to use a for (or for each) loop to trace the properties of an event to the output window. I know I can trace the event in one go, like this:
[Code]...
View 1 Replies
Mar 2, 2011
I am working on an animation project. I'm not a programmer. I'm working in Flash CS3. I've an animation that I've produced that I need to output the placement of my audio track for use by the post-sound guy. After my recording session, my sound guy gave me one large file that had all my audio on it. I've had to scrub to the correct position on the audio track for each clip I wanted.
Now that my animation is completed, I've got my audio all in place, but I need a record of where it's at in the Flash Timeline so that I can give that to my post-sound guy so that he can rebuild it in his sound editing software.
What I'm wondering is if there is a way to run a trace or generate something of a text file that will do the following[code]...
View 3 Replies
Oct 26, 2010
I'm trying to trace Mc Identifier names on timeline keyframes. But it does not work for keyed frames...
-I have an ordinary keyframe animation on the root timeline. -each keyframe is a movieclip (exported for actionscript and a class created in the library/properies)
-I try to trace every frame, but for some reason my script ignores the ones with a keyframe in them and reads the emty(grey) timline areas.
since the whole deal for me is to create a very simple timeline exporter
how to get the names for frames with a key in it?
(I pasted this clip on first frame in timeline)
Code:
import flash.events.Event;
import flash.display.MovieClip;
this.addEventListener(Event.ENTER_FRAME ,getStageChildren);
[Code].....
View 1 Replies
Dec 10, 2010
I have a button on the main timeline that works fine, part of the code in the button:
for (b=1; b< dpth; b++) {
var lineMovedx = _root["Line"+b]._x;
_root["Line"+b]._x = lineMovedx-9000
trace(_root["Line"+b]);
It basically moves stuff a person draws off the screen when the button is pushed, there is another button that brings it back. But when I put that same button in a movieclip on the main timeline and change the code to this:
for (b=1; b< dpth; b++) {
var lineMovedx = _root._root["Line"+b]._x;
_root._root["Line"+b]._x = lineMovedx-9000
trace(_root._root["Line"+b]);
It no longer works and the trace shows no output, it basically loses it completely, I can't figure out why it does not work, it seems so simple.
View 1 Replies
Mar 16, 2012
I'm getting the geolocation data of a viewer and creating a textfield to display this data (city,state). After the data is pulled the text is measured to fit in the textbox and if the length of the city is too long, the text is adjusted in size to fill the textfield. When I trace the end result of the final text size, I keep getting the (same) trace result outputted infinitely.
[Code]...
It worked, but I needed the text box to be made according to what data was pulled from the geolocation xml, so I added it in the geolocation script.
View 1 Replies
May 20, 2011
I have made 30 movieclips for my level selection screen. Then I create a movieclip with the same name using a for loop. With that code I make roll_over function showing a Tooltip. I then want to trace what button is being clicked. My whole code is here: [URL] I want to trace what button is clicked, so I can show it on my tooltip textbox.
View 4 Replies
Feb 23, 2010
For the life of me I can't figure out how to trace out the current label in my movie's main timeline. This is in AS3. I have a button on stage that spans the timeline of the movie. It detects keypresses. I want to trace the current frame label that the play head is on.
[Code].....
I get "_level0" for this...and undefined for the rest. What am I doing wrong here?
View 1 Replies
Aug 5, 2011
what i whant is when any of the units get to a certain distance of the enemy it should trace(shoot).
[CODE]...
View 6 Replies
Apr 2, 2010
When I put a trace("test"); at the entry point of my flashdevelop project and run it. The application runs fine but I do not see the trace in the output. Below is my code
package
{
import flash.display.Sprite;[CODE]...
View 2 Replies
Dec 29, 2010
I am using FlexUnit4 with FlashBuilder4. A lot of the classes that I'm unit testing make use of the Flash Logger.In the main app, we use TraceTarget so that the logging shows up in the trace window, which greatly aids in debugging:[code]I'd like to do the same thing for the unit test runner that FlashBuilder generates (FlexUnitApplication.mxml), but I'm not sure how to go about it. I could, of course, add TraceTarget to FlexUnit Application. mxml, but as the warning at the top of the file says,My question is: how do I get logging-to-trace to work with FlashBuilder and FlexUnit?
View 1 Replies
Mar 12, 2012
I cant seem to work out to trace the content of a data grid i have populated with info;Once I can work out how to trace it or each row i would push it into a new array for exporting.
so for example: i have a datagrid instanceNamed(info) //populated from a CVS file; text file//
containing 150 rows and 15 columns. I would simply like to trace this in the output window .From then i will work out how to write to disk. i have been searching around but cant seem to find a solution to this problem.
View 2 Replies
Oct 17, 2006
I have the following code in the main timeline:
[Code]...
how to make the final trace statement work?
View 5 Replies
May 18, 2011
How can I reorganise the code below so the trace commands output i for each element in the photourls array and not just the last element? In a 6 element array, the trace(i); line outputs 5,5,5,5,5,5 rather than 0,1,2,3,4,5.
[Code]...
View 2 Replies
Jul 3, 2009
I got this weird problem, when i run this code:
Code:
package {
import flash.display.MovieClip;
[Code]....
In Flash Cs3 it acts exactly as i want, the ENTER_FRAME runs and the addObject places numerous sprites on the stage. In the window output i'll see the trace. But when i run this code in Eclipse which is set up to use the Flash Player as output i get the first trace from EDHV_ImageSlider but the traces inside addObject won't show up, the sprites however are generated perfect.
The difference between the eclipse setup and the cs3 setup is the fact that the cs3 setup has a *.fla which calls the *.as package.
View 1 Replies
May 29, 2009
I am having issues with a global array. I have an actionscript file called MyGlobal.as at the same level as my main FLA:
[Code]....
I am able to trace that first element while trace is called within the function... but if I try to trace that first element outside of the function it is "undefined". Do I need to return the array at the end of the function? I tried that but I cant seem to get it working correctly.
View 4 Replies
Nov 9, 2011
I've been playing with prototype a bit and I've noticed that either it isn't as static as it should be or that some functions are protected from altering, or that in some cases the prototype actually extends a function. For example, I was trying to modifiy the global trace function to output the current time of a trace action, something like this :
Code:trace("lulu"); // output 12:48:17.286 lulu I DID achieve something close to it, but it seems that I haven't actually modified the global trace function, but rather it's "_root" counterpart,
[Code]...
View 3 Replies
Nov 14, 2009
ive got a loaded xml list for an mp3 player. from playing track1, when i select track 2, it traces "track1" but then after a second click it traces "track2" and stays on that. the actually music for track2 does load on the first click though, but not the trace. anyone know why on the first click it would still trace the previous track? here is the code for that function...
[Code]...
View 9 Replies
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
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
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
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
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
Apr 29, 2009
i just want my loop to keep playing regardless of the timeline stopping and starting. is this possible?
View 1 Replies
Feb 15, 2011
I have a movie clip "picture", which has different pictures in different frames. I also have a button to make the picture go to a given frame for every frame. There are so many buttons that they won't fit into same "page", so I have a movieclip "buttons" which has buttons on different frames. As I have hundreds of frames in the picture it'd feel silly to put
PHP Code:
on(release){
_root.picture.gotoAndStop(frameNumber);
}
[Code]....
The code works for the first frame of the buttons movieclip, but when you go to a new frame it stops working. And if you return to the first frame it won't work there either any more. Is there anything I could do, or do I have to put the for-loop in every frame of the buttons movieclip (replacing "_root.buttons" with "this")? It'd be a lot of work, since I have quite a many frames in the buttons movieclip as well.
View 8 Replies