ActionScript 3.0 :: If Statement Doesn't Affect For Loop?
Jan 15, 2011
I wrote a function within a function to control 2 Tweens.(the 2nd one isnt in the function, it's called)My problem is... is that it works for the first time.. the button is hovered over and all the other buttons show themselves and then disappear again, except the one you're over. Then I do it a 2nd time and it doesn't work. why is it only working right one time? and why isn't the if statement I put in the local function affecting the for loop? The 2nd time it takes the button you're hovering over with it and fades it out. (even though the if statement registers according to trace)this is the code
import fl.transitions.Tween;
import fl.transitions.easing.*;
var shortInst:Array = [btn1, btn2, btn3, exit];
[code].....
View 6 Replies
Similar Posts:
Jul 11, 2009
I have a project in mind in which I would like 3 sets of interlinked images that are displayed on the same stage. While the mouse is over one set the wheel button allows for scrolling through that set of images and so on for the other two sets of images.
How do I separate the three sets of images, so that scrolling through one set doesn't affect the other sets on the stage? Each set has about 30 images each.
View 4 Replies
Jun 14, 2009
im trying to make a website based on a tutorial. when a certain button is clicked a selected page will load when the previuos page plays the OUT:label and hits the end label which are situated on the every pages mc timeline. Tyhe problem is that the function doesent work
the function is like this
Code: Select all
kontakt_btn.addEventListener(MouseEvent.CLICK, newPage);
function newPage(e:MouseEvent):void
[code]...
View 3 Replies
Dec 23, 2009
I am executing a hittest when a chicken meets a crocodile; the chicken is afraid for the crocodile and turns back flying up in the air and back on the ground. In fact most of it works, allthough I can't get the wings to stop fluttering. As soon as the chicken returns on the ground, this must happen.This is the piece of code where it is about: (the function winger() is called once at the hittest)
[flash=]function winger()
{
var counter:int=0;[code].......
without the counter it works. changing it into an if-statement with the counter af the 2nd tweener, doens't work either.
View 1 Replies
Aug 24, 2009
I'm doing a simple array test...I thought I could have values in an array and then run it through a loop and have a IF this value equals "x" do whatever, ELSE do this.
I have the value on a button and it doesn't work.The loop runs but the IF ELSE statement doesn't do what I THOUGHT it should do. It runs every value through the script as if the IF ELSE statement doesn't matter. Am I missing something?Here's the flash code (see below):
var myArr:Array = new Array;
myArr = ["red", "green","blue"];
function checkArr (checkTest){[code].....
View 7 Replies
Aug 3, 2010
I need to loop an if statement, it's based on a OnMouseOut type event so EnterFrame won't work. My issue is I am trying to unLoad image on mouse out, but sometimes more than one image is loaded. I need a loop to check if the mc.numChildren is 0, and if it isn't, remove another Child, then check mc.numChildren.
numChildren I discovered tells you how many children (or layers) have been attached.
Heres my pathetic attempt: (which doesn't work, obviously :S)
ActionScript Code:
var STOPIT:String = "No";
function RemoveImage(event:Event) {
if (STOPIT == "Yes"){
[Code] .....
View 4 Replies
Apr 15, 2011
I tried using this code but it seems to always view the start value as bigger than the end value (probably because of the loop), even if it's inputed as a smaller number on the stage.
ActionScript Code:
if (startValue<endValue)
{
[code]......
View 3 Replies
Aug 8, 2010
I have some code for validating e-mail data before it is send. I have including code from Bassem Bouguerra www.sub-science.com which uses the WebServiceConnector and deals with imaginary user's emails. The code validates my 3 fields correctly. The problem is that the last if ...statement doesn't execute despite that the data is correct and my ok and result variables are true. It is driving my mental.
stop();
import mx.services.*;
_lv = new LoadVars();
[code].....
View 3 Replies
Jan 21, 2012
Is it possible to use a for loop within an if condtional statement? I have been trying but just get errors no matter what I do. I have a series of buttons that pop up in a window and I want to make it so a click anywhere outside of the buttons will close the pop up window. I have been doing this by running a hitTest that checks if any of the buttons are being touched one at a time. It works, but it seems overly tedious, especially since there are a lot of buttons. I do not want to put the hitTest on the background of the window because it will cause the mouse cursor to turn into a hand even when it is not over one of the actual buttons.
If the for loop can't be within an if condition, then maybe there is a better way to use the hitTest code, but I couldn't figure that out either. Here's a simplified version of what I have now (it works, but is too much code..):
[Code]....
View 6 Replies
Jul 18, 2011
Code 2 assume that main = main + sub even if it doesn't exist outside the if statement, that's obvious since sub is an empty string.
[Code]....
View 4 Replies
Aug 18, 2006
Code:
_global.picWmax = 436;
But when I call the imageSize function with the if statement it doesn't work.
Code:
function image(){
[Code]...
View 3 Replies
Jun 13, 2011
I was wondering if there's any way to loop an if statement so that it's constantly updated?
My code:
if(reel_mov.x==14){
l_button.visible=false;
} else{
l_button.visible=true;
}
View 1 Replies
Oct 28, 2002
I have the following which works fine just out side of the loop statement:
loadMovie("icons/test.jpg", "pIcon0.Icon");
But inside the loop statement no image shows up.
I need it in the loop statement because eventually the code will call the jpgs out of an array based on the loop variable. And put them in a movieclip number by the variable also.
View 1 Replies
Oct 26, 2009
I need a solution to this simple problem.
var myName:String = "Pink Floyd Sound";
var i:Number;
myFig = new Array();[CODE]....
I want to display the string text 10 times using the for loop. I did this, and all I get is undefined.
View 2 Replies
Jan 1, 2004
why this doesn't work? I'm about to go crazy! It's just supposed to be background music and it plays once then stops. WHY?
[AS]
backsound = new Sound();
backsound.loadSound("sounds/loopy.mp3", true);
[code]....
View 1 Replies
Nov 25, 2011
This is an if stament on a frame on the root. I want to loop Carrera(a lenghthy movieclip) from frame 2 back to frame 1. (For testing purposes) This is the code:
[Code]...
View 3 Replies
Mar 4, 2003
can someone open up this .fla and tell my why they think it isnt working.. theres the wierd little chain thing doesnt start from the right spot and i dunno how to fix that
View 3 Replies
Jan 1, 2004
It's just supposed to be background music and it plays once then stops. WHY?
[AS]
backsound = new Sound();
backsound.loadSound("sounds/loopy.mp3", true);
backsound.onSoundComplete = backsound.start;
[/AS]
I have also tried backsound.start(0,999); but it doesn't work either.
View 1 Replies
Apr 29, 2005
i have a loop as follows and the positioning is doing nothing, they are all just standing in one place one on top of the other.
Code:
this.createEmptyMovieClip("thumbHolder_mc", this.getNextHighestDepth());
for (var i:Number = 0; i < 20; i++) {
var thumbnail = "thumb" + i + "_mc";
[Code]....
View 3 Replies
Apr 6, 2003
See attached file:Why doesn't this work
View 2 Replies
Mar 20, 2007
A couple weeks ago, I was searching for a delay function that I could put on a frame and it would hold at that frame for a given period of time.I came close to finding it, but what I found used setInterval and I wasn't able to stop it from looping.Here is something that I am quickly starting to love, it's not mine, but I don't know who's it is, it was on a piece I was working on at work (although this edition of it is partly mine, as I have adapted it to my specific needs).first frame
Code:
//wait function
function wait(a) {
[code].....
View 2 Replies
Feb 16, 2011
It stop sound sometimes and sometimes it doesnt
var soundReqTele:URLRequest = new URLRequest("sounds/telephone_ring.mp3");
var soundTele:Sound = new Sound();
var controller:SoundChannel = new SoundChannel();
soundTele.addEventListener(Event.COMPLETE, soundLoaded);
[Code]....
View 1 Replies
Apr 29, 2005
i have a loop as follows and the positioning is doing nothing, they are all just standing in one place one on top of the other.
[Code]...
View 3 Replies
Feb 17, 2011
My FLVPlayBack integratino doesn't work : menu don't show, the video don't loop .
It's here :
[URL]
And the code generated by flash CS5 pro :
<div id="flashContent">
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="385" height="282" id="pic-du-midi-fevrier-2011" align="middle">
<param name="movie" value="videos/pic-du-midi-fevrier-2011.swf" />
[Code]....
View 2 Replies
Jan 12, 2010
it seems like my prog doesnt really care about the "for" loop at the bottom. anybody know why?i can move my character left and right, but when i press space, he "jumps" 1 inch, but he doesnt do whats demanded in my loop :/i know i wont be able to make him jump again and the jump would look weird etc. but for now id just like to make him do anything when i press space.[code]
View 1 Replies
Aug 27, 2005
i'm working on a gallery that loads thumbnails from an xml file into 3 columns and when you click on a thumbnail it opens a new window with the fullsized image in.
I have modified code from a gallery tutorial to load the thumbnails from a xml file. They are going in 3 columns at the moment (I don't understand why but they are) but only the last image has a hand cursor when you rollover it, and then when you click on it, it traces "undefined" into the output box.
I have put
Code:
trace(images_arr[i].attributes.fullsize);
just below the bit where it loads the thumbnails and it traces the right path from the xml file for each image.
get it to trace the right path from the xml file when you click on ALL the thumbnails, not just the last one.
Code:
function GenerateThumbs() {
images_arr = images_xml.firstChild.childNodes;
gap = 10;
[Code]...
View 3 Replies
Apr 15, 2008
I have a class file that contains a for in loop. basically there are 50 states (movieclips) on the stage and here is what I have:
[Code]...
I don't think I understand enough about arrays or for in loops to understand why this isn't working... it traces the array, but not statesArray[states], and it doesn't change the alpha of anything.
View 1 Replies
Jun 25, 2009
Ok, I am trying to build an AS3 XML video player. I got the XML down and the basic for loop working. Now I am trying to have a container load movie clips based on the number of that particular node I have in my XML.
Here is the confusing part, when I am using the for loop to load in the XML and get it to play my video that works fine. Then I add my code for adding my movie clips into my holder and that works fine also, but this breaks everything else. I have set my flv component to autoPlay = false, so I can get my play button to work, but that is broken as well as the video not playing.
I dont think it is a naming issue because when I dont have the "with" statement everything works fine. When I add the "with" statement, that works fine but breaks everything else. The other weird thing is I am not getting a compiler error, nor a syntax error, so I have nothing to even Google. [code]...
View 3 Replies
Apr 5, 2005
I have 'Sound On' and 'Sound Off' buttons on mutiple scenes and I am playing the music loop in my flash movie by loading an external swf. When I move to the next scene the sound reloads which I do not want. How do I use an if-statement that checks whether or not the music.swf, that needs to be loaded is found and when it is found, go to a frame?
View 1 Replies
Jan 18, 2012
i put this in actionscript
on(release)
{
getURL("htt://glennbeyer.freeiz.com/unreal.html");
[code]......
View 8 Replies