ActionScript 3.0 :: "With" Statement Break My For Loop

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


Similar Posts:


ActionScript 2.0 :: Break The For-loop From Within The OnLoad-function

Feb 21, 2004

I would like to break a for-loop. It should be easy with "break;", but there is a slight complication to the code - the for-loop contains a function from within which I want to be able to break the loop. Here is a codesnippet:

[Code]...

So, somehow, I want to break the for-loop from within the onLoad-function. Is that possible with some other code (this ofcourse doesnt work)?

View 6 Replies

ActionScript 3.0 :: How To Get If Statement To Loop

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

ActionScript 3.0 :: Use An If Statement With This While Loop?

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

ActionScript 2.0 :: For Loop WITHIN An If Condition Statement?

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

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

ActionScript 3.0 :: Any Way To Loop If Statement For Constant Updating?

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

ActionScript 2.0 :: LoadMovie Command Not Working In Loop Statement?

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

ActionScript 2.0 :: The 'for' Statement - Display The String Text 10 Times Using The For Loop?

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

Actionscript 3 :: If Statement Not Working - Loop Carrera(a Lenghthy Movieclip) From Frame 2 Back To Frame 1

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

ActionScript 2.0 :: Music Loop - If Statement - Check Whether Or Not The Music.swf

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

ActionScript 2.0 :: First Requirement Of The If Statement When Type In The Proper Input And Go Straight To The Else Statement

May 14, 2009

Having a few problems with what I thought was a simple if statement. Here is the code:

[Code]...

I can't quite figure out the small problem with the code. It seems to just bypass the first requirement of the if statement when I do type in the proper input and go straight to the else statement.

View 7 Replies

ActionScript 1/2 :: Execute Code In Previous If Statement If Second If Statement Is Executed?

Aug 31, 2011

if (variable == 1){
//code
//Execute this code.
} else if (variable == 2) {
//code

[Code]...
 
I dont want to copy the code from the first into the second and the first and second into the third.
 
My mind isn't working and there is probably an extremelly simple way to get this working.
 
I know I could used functions but for some reason it stops the instance referencing working: _root["bullet"+j] doesnt work in a function.

View 7 Replies

ActionScript 2.0 :: Loading Data From XMl File And Uses It To Run An If Statement. If Statement Fails?

Oct 10, 2008

The Flash movie contains 2 Text files, one Component button, and 1 component checkbox.The purpose of the application is to load an XML file(works)Populate 2 text fields with information from the XML file(works)Compare the two text fields, if they contain the same information then the checkbox, via AS is told to be selected. (Heres the problem);

Heres the code:

Code:
runCode_btn.onPress = function() {
data_xml = new XML();
data_xml.ignoreWhite = true;
data_xml.onLoad = function(success) {

[code]....

The idea behind this app is that its an electronic form. The user fills it out, the information is then sent to a newly created XML file, months later the open the XML file in flash, and Flash fills out text fields and check and or unchecks Checkboxes based on the XML data.CheckBoxes are mandatory.But I don't see how I'll be able to use them if i can't create and condition statements based on the loaded Data.

View 1 Replies

ActionScript 2.0 :: If Statement Inside If Statement Won't Work

Mar 30, 2011

why this code won't work

[Code]...

I'm sure you can put if statements inside other if statements, seriously I can't figure it out

View 4 Replies

ActionScript 3.0 :: Another 'if' Statement Inside An 'if' Statement?

Sep 22, 2010

I need to write an if statement inside an if-else statement. But no matter how I write it it keeps giving me a syntax error.The syntax error is "1083: syntax error: else is unexpected".[code]No matter how or where I place the braces, it keeps giving me errors.

View 13 Replies

ActionScript 3.0 :: Use A For Statement To Create An If Statement

Jul 12, 2010

what I'm trying to do is create an else if argument for each object in an array based on a user set number

Code:
for(var i:int=0; i < numberOfElseIfs; i++){
GENERATE AS3 CODE
}

to which I want it to GENERATE THE FOLLOWING CODE:

Code:
}else if(baskets[i].used == false){
baskets[i].used = true;
drawButton(i);
}

the problem is obviously that the compiler reads this code rather than understanding I'm trying to regenerate the code within the for loop...does that make sense :S? So basically I need as3 to read the code between the for statement as if it is going to echo that out later. Is this even possible?

View 4 Replies

ActionScript 3.0 :: Write Another "if Statement" Inside Another If-else Statement?

Sep 22, 2010

I have a script which is giving me a lot of trouble since I have no idea how to write another "if statement" inside another if-else statement. I keep getting errors, I guess I don't know where to put the braces exactly...

example:
if(bla == bla) {
<------------how would I write another if statement here?
}else if (bla == bla){
}

View 3 Replies

Break Up A Bitmap?

Apr 21, 2009

I'm trying to break a movieclip into pixels and then move each pixel independently, but am having a hard time wrapping my brain around the code.

Right now I have a MC on the stage with an image in it. I'm able to go through each pixel, copy them one at a time then add a tween like this:

Code:

function copyPixels() {
var rect:Rectangle = new Rectangle(300, 400, 1, 1);
var bytes:ByteArray = bmd1.getPixels(rect);
var bmd3:BitmapData = new BitmapData(1,1, true, 0xFF000000);

[Code]...

But that doesn't really give the effect I want. I want the whole image visible then have one pixel at a time fly off. How do I do this? Do I copy the entire image to a ByteArray then address each element in the array?

View 3 Replies

Using As Line Break

Nov 8, 2010

I've setup a dynamic Text Field, embedded uppercase, lowercase, numerals and punctuation and these special characters: Then I assign text to the Text Field like this:

[Code]...

View 1 Replies

Break Out Of An Entire Function?

Jul 3, 2009

I've got a for loop running in a function. I want to break out of the entire function if a condition is met in the for loop, and obviously carry on within the function if not. I've read a little about using labels, but I'm new to actionscript and most of it's going completely over my head. Here's my code.

[Code]...

View 1 Replies

ActionScript 2.0 :: Xml Line Break?

Jul 29, 2010

i'm trying to put a line break in my xml attribute but the usual doesn't seem to work. Can anyone solve this? Cheers

<BUTTON NAME='BUTTON 1
TEST' DESCRIPTION='' MCCOLOR='0x000066' THEFILE='one.jpg'/>

View 2 Replies

ActionScript 2.0 :: Break Line In The XML?

Sep 18, 2010

How can I break line in the XML in a specific part?

I want this
DE R$ 999,99 POR 666,66

To be this.
DE R$ 999,99
POR 666,66

XML:
<price>DE R$ 999,99 POR R$ 666,66</price>

AS:
price_txt.Text = priceID;

I can not put a line break in xml.

View 8 Replies

ActionScript 2.0 :: Break A Textfield With It?

Oct 25, 2006

Is it possible to break (Ctrl + B) a created textfield with AS, and have the letter instances named somehow? I need this to write a text animation.

View 11 Replies

ActionScript 2.0 :: Break Onto The Next Row After Duplicating

Nov 11, 2009

i've read some other threads about this but i can't seem to get them to work with my script..i'm trying to fill my stage with squares to make a visual grid, using setInterval so it shows them animating across row by row. so far i have this:

[Code]....

however i've tried adding in code to make it break onto the next row after duplicating 50 but can't seem to get it to work no matter what i do..

View 2 Replies

ActionScript 2.0 :: Break Line In XML?

Sep 18, 2010

How can I break line in the XML in a specific part?[code]...

View 4 Replies

ActionScript 3.0 :: Take A String And Break It Into Two Parts?

Sep 15, 2010

I'm trying to take a string and break it into two parts. It's a url to a video on a RTMP server.So I've got to take this:

[URL] person17/1031617_person_generic_700kbps (note the removal of the ".flv" which is necessary as well).Right now I'm doing this, which seems overly complicated:

Code:

videoURL="rtmpe://emediadev.mysite.com/ffw/person17/1031617_person_generic_700kbps.flv";
videoURL=videoURL.substr(0,videoURL.length-4); //remove ".flv"
var urlArray:Array=videoURL.split("/");

[code]....

View 1 Replies

Line Break When Importing A .txt File?

Oct 5, 2010

i'm using this code i got on-line, the text is being outputted through a dynamic text box, which is multi line enabled and html. Yet I just can't seem to get a single line break, i can get a double by doing a normal line break in notepad. But i need a single. And <br> doesn't seem to work.

Quote:

myLoadVars_lv = new LoadVars();
myLoadVars_lv.onLoad = function(success) {
if (success) {

[code]....

and my text file is

Quote:

variable1= 1) Blackpool 02 Academy, 14/4/10, 19:30, 4.50 <br> Liverpool 02 academy, 25/08/11, 13:00, 5.00

View 5 Replies

Data Integration :: <br> Break A XML Parsing?

Oct 25, 2006

I make a XML connector component parse a XML document.In a node, there is a "<br />" (return to line in HTML)

<book>
<page>

Here some text and a <br /> here ! the code s broken up here

</page>
</book>

My XML connector considere the <br /> as the beginning or the end of a node !...How to avoid this <br /> or other any HTML element when parsing some XML ?

View 1 Replies

ActionScript 3.0 :: Line Break Does Not Work?

Jul 6, 2009

I have content with line break. When I break the text matter it shows following error. Is there any technique so that I could use line break content matter.
 
Syntax error:A string literal must be terminated before the line break.
 
Code :
output:TextField:TextField=new TextField();
addChild(output);
outputText.text("Number of characters including
line  breaks and spaces so far: ");

View 3 Replies







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