ActionScript 3.0 :: Simple While Loop Doesnt Function?
Oct 29, 2009
For each product a label is created determing its category unless a label of that category has already been created before. My while loop is supposed to stop the same label being created twice but apparently it doesnt! My function consists of an array of categories (kategorie[]) and an array of labels that were previously created (previousLabels).
I've got 2 AS3 files going here, the document file "Main" and a "Fence" file..[code]For some reason the ping comes up, but the pong doesn't, it's starting to bug me now that the "onFenceAdded" wont even work, what have I missed? Is there some way to check if Flash is compiling correctly? I often find these weird problems where I'm sure I've done it all correct, but when I try to compile and run a swf it wont work!
If you place a for loop in a recursive function with the function call within the loop... will the loop finnish or does it stop working untill the last recursion?
I have unfinished code I'm working on. It has a listener event and a function. I notice when I put the for loop outside the function (it would be below the last line) it doesnt execute. Why doesnt the code I type outside of the function execute? I need to know for future reference
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.
im a complete noob. how would i get this code into a simple 'for loop' to add 3 sprites named heart1, heart 2 and heart3. basically to simplify this mess
ActionScript Code: var heart1:Sprite = new Sprite(); with (heart1.graphics) { beginFill(0xFF0000); drawRect(0,0,20,10);
I'm an AS2 convert and struggling. I can't figure out how to get my function to see my array. I keep getting an error that "i" is an undefined property.
var thingsToShrink:Array = new Array( b1, b2, b3, b4, b5 );
function shrinkBars(myArray:Array){ for (i=0; i < (myArray.length); i++){ myArray[i]._yscale = 0; }}; shrinkBars(thingsToShrink);
I'm trying to make a simple for loop that makes a line move. But it won't work, and when i search for "for loop" it gives me all these dynamic things that are WAY over my head.[code]The way i see it, the i should increase by 1 each time the loop is run, and then the line will move up by 1 until it is at x = 0 (it starts at x = -77). But when i preview it in flash and html, nothing happens at all.
I have looked everywhere for an example or tutorial on a delta time game loop in AS3. I found many fixed time step examples but very little helpful information on delta time game loops and how it works. I have seen examples that do the calculations in a timer and also seen examples that do the calculations inside the enter_frame event. All the examples I have seen are also incomplete and only provided me with bits and pieces.
I've set up a simple enter frame loop to adjust the alpha on a grid of movie clips ("bubbles") using a distance formula from the mouse pointer.I've got a hunch that while this works fine, there's a more efficient or processor friendly way to do it.
grid of mc's created here....and pushed into an array stage.addEventListener(Event.ENTER_FRAME, loop); function loop(e:Event):void{ for each (var j in bubbArray)[code].....
I have a variable in a loop that i want to access in a function outside of the loop. However the variable gets deleted when the loop is closed so no longer exists when i call in the function.here is the code; i'm trying to access the variable picHeight from within the scroll function
I have been searching the net for a tutorial how to graph functions. I found one from Barbara Kaskosz, very detailed, and too much scripting. Too much for me. Is there another way or place to learn, or I am doomed, and have to face the music and study her stuff. All I want, is to be able to graph a simple function.
I thought I would share a simple pad string function I created briefly... I know that there may be other similar functions already out there but I decided to make it anyway. It's basically a ripped off as3 version of the str_pad() php function.
Well I'm so close to understanding why this doesn't work. First here is the code:
Code: import flash.display.MovieClip; stage.addEventListener(Event.ENTER_FRAME,updateGame); var gameZoneContainer:MovieClip = new MovieClip(); stage.addChild(gameZoneContainer);
[Code]......
If I place "fish_mc" in place of "Items[createItemCounter]", the fish animates but the cookie doesn't. If I put "cookie_mc" instead of "Items[createItemCounter]", the cookie animates but the fish doesn't.
I'm modifying an mp3 player by flabell, and try to get some buttons to work. However, I can't seem to get the getURL to work, even though it works in other parts of the script. This is my code: mc.rate1.onRelease = function() { trace(this.ID); getURL("[URL]","_blank"); };
The trace goes through fine. Here is the code that works: Code: private function downloadRelease(mc : MovieClip) : Void { var title : String = mc._name; var index : Number = Number(title.substring(title.lastIndexOf("n")+1,title.length)); getURL(songsSource[index], Main.getInstance().mcAlbums.linksTarget); } I'm on a mac with firefox.
i've tried searching the forums and fighting with this way of fading the movie clip in and out. The movie clip has an instance name of "box", my brother also can't figure it out.
Code: var fadeChecker:Boolean = true; function flicker():Void{ if(box._alpha >= 100){[code].....
basically i have a mc that i want to use as a button.
frame 1 is the initial state with a stop() action on it. frame 10 is the full rolled over state, also with a stop() action on it, and frame 20 matches frame 1.
so basically i want the button to animate frame 1-10 if they rollover, and animate frame 11-20 when they roll off. i would also like it to detect the current frame, so like if the user rolls off and rolls back on at frame 15, it will play backwards to the mouseover state (frame 10).
create a button, create a movie clip with two frames.
place a button instance in frame 2.
place a mc instance on the stage.
create another instance of the button to change the movie clip instance to frame two.
the button in the movie clip is pressed and executes a function.
here's the code
Code: // create the button to show the button! _root.button_instance_2.onPress = function() { buttonClick1();
[Code].....
if, however, i use the same code on a movie clip that has only one frame it will work fine. do i need to tell the function to target the button instance any more specifically than that?
basically I have an MC menu that I want to move to the left when you click and hold on another MC called leftButton, here's what I have.In main timeline:
I am trying to index a series of movie clips with their own unique index number for accessing through AS3. The example below is what I would like to achieve, when a user clicks on Topic1, I can trace back the index of 1, when a user clicks on Topic2, I can trace back an index of 6:
This seems like a simple problem but I can't seem to figure it out. If I use this standard code from the reference:
ActionScript Code: var nc:NetConnection = new NetConnection(); nc.connect("rtmp://myserver/"); var stream_ns:NetStream = new NetStream(nc); my_video.attachVideo(stream_ns); stream_ns.play("myflv");
the video streams fine, but if I put the exact same code within a function like this:
i have been messing around with a script found for a simple paint program. After adapting the code a bit for my own needs and getting an understanding of how it works I had a couple questions.first of all I need to create a button that will clear the stage (or more specifically lvg1)second what does e reference in lines similar to
I made 5 buttons on the stage. When these buttons are clicked I want to show AND hide items related to the buttons. Is there a way to "toggle" a simple button so that when it is cliked the first time it shows the object, clicked a second time it hides the object using the same function? In other words, is there a property of a simple button that changes state?
I am trying to combine TweenLite with some of my own functions. Now for testing I have this: Code: function playGeb(indG):Void { if (indG < 8) { clearInterval(restartG); gebArr[indG].play(); [Code] ..... but after the arrow is in place the function hello() isn't been called. I already tried adding, onCompleteScope:this TweenLite.to(arrow_mc, 0.3 , {_x:118,_y:30,onComplete:hello , onCompleteScope:this});
i am new to this and i need to put a simple picture show an a web page, i need it to work like a powerpoint presentation but also needs buttons that you can roll your mouse over and have the slide that is associated with it come back up and also need to be able to click it to bring it back and stay on the screen for a longer period of time.