ActionScript 3.0 :: Continue Through For Loop When 1st Condition Is Null?

Nov 9, 2011

I'm wrestling with an issue right now and I'm hoping for some help, and more so, I'm hoping I can explain my problem. With the thought of a "fill in the blank/drag and drop/string replacement" interaction, here's how my swf works:
 
I have a various movie clips that can be dropped on various movie clips.When one movie clip is dropped on another, the corresponding __#__ within myTitle.text will be replaced with a string that is related to the movie clip that was just dropped: i.e. myTitle.text becomes 'This is the most annoying [thing]...'Per that example I just mentioned, in the code below, my for loop searches for __1__ and moves the hTarg movie clips accordingly.Once a __1__ is replaced with the associated string I mentioned, the indexOf the __1__ becomes null because it no longer exists in the string, and the following startRect(s) below also become null. 
So, my question is: How do I continue to loop through my for loop if the first index is null? I hope this makes sense, and I'm hoping someone can ituit what I'm trying to do based of my lousy explanation. If more clarification is needed, let me know and I will do my best to further explain.

[Code]...

View 5 Replies


Similar Posts:


Flash Loop Error Want To Continue

Dec 7, 2010

I have a flash loop with a function inside (nothing special, just looks through some text files on hard drive). However, some of the files don't satisfy, this is expected and the program throws an error as expected. No surprises there.But! I would like it to move on to the next text file when it finds a bad text file. Instead, it just stops everything.[code]

View 1 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 :: While() Loop With Condition For Each Value In An Array?

Jul 15, 2009

Just wondering...s it possible to create a while() loop with as condition comparing a value against all items in array?e.g.

ActionScript Code:
while(myValue == for each(var i in myArray)) {
//Do Something

[code]........

View 3 Replies

ActionScript 2.0 :: Pause If Condition In A Loop?

Mar 9, 2011

i tried to use setInterval() and Timer function, but it doesn't work

Code:
for(i:Number=0; i<100; i++){
if(i%2 ==0 ){
trace("--------");

[code]....

View 5 Replies

ActionScript 3.0 :: Dynamic Condition In A Loop?

Oct 11, 2010

I have a loop in a function which condition depends on some variables a,b,c and d. I would like to change that condition depending on where the function is called from. Would it be possible to assign those conditions to a variable (string maybe)?

Like this

function varcon():void{
while (conditionVar){
a=...

[Code]....

View 4 Replies

ActionScript 1/2 :: Make The For Loop Continue Only After _root?

Sep 28, 2010

for (i = 0; i < _root.myArray.length; i++)        {                _root.searchAndDestroy();        }
 
how do i make the for loop continue only after _root.searchAndDestroy(); has finished it's task?

View 7 Replies

ActionScript 3.0 :: Loop A Section 5 Times And Then Continue?

Oct 15, 2010

I've been looking at other posts and trying to cobble this together, but am lost.I have a movie I need to play from frames 1-45 five times then continue from frame 50 to frame 70 and stop.on frame one I have the following script (in a layer for actions)

if (numberOfTimesToLoop<3) { gotoAndPlay(1); numberOfTimesToLoop++; } else { gotoAndPlay(50); } [code]....

this doesn't work, and I've tried many variations.

View 8 Replies

Flex :: Hold And Continue FOR - LOOP From The Same Spot?

Sep 6, 2011

I got a for/foreach loop the calls a function inside of it. The prolem is that the function being-called doesnt fininsh it's job before the loop goes over again/ Here is my code:

[Code].....

As you can see i want to add an item (notfriend) in MYFRIENDS unction, "notfriend" is defined inside the loop, but by the time "MYFRIENDS" function finish loading the item already changes to the next item even though i was originally refering to the previous item. Is there a way to maybe hold the FORloop until "myfriends" function finish loading.

I wanted to use Eventlistener on "myfriends" function , but then what do i do to stophold the loop? all i know is BREAK-which destroyes the FOR-LOOP and CONTINUE-which continue the loop from the next iterate.

View 2 Replies

ActionScript 2.0 :: SetInterval - Loop Then Pause / Continue

Jun 2, 2004

I have only been using flash for a few months and have not yet utilized setInterval. I have a loop that I want to run through once and then pause and then continue etc. So I can have each little test.swf pop up one by one rather than all at once

Code:
createEmptyMovieClip("menu", 10);
function createMenus() {
aMenu = new Array();
aMenu = ["test.swf", "test2.swf", "test.swf", "test2.swf"];
for (i=0; i<aMenu.length; i++) {
menu.createEmptyMovieClip("menu"+i, 100+i);
menu["menu"+i]._x = i*100;
menu["menu"+i]._y = 100;
menu["menu"+i].loadMovie(aMenu[i]);
}}

View 3 Replies

Actionscript :: Flash, Ns - Loop A Flv If A Condition Is True?

Feb 12, 2011

I need to loop a flv file in flash if a condition is true.

So I tryed to add a listener but id doesn't work.. Code below:

textBox.addEventListener(FocusEvent.FOCUS_IN, focusInListener);

var connection:NetConnection = new NetConnection();
var stream:NetStream;
var video:
Video = new Video(200, 200);
var metaObj:Object = new Object();

[Code]...

View 2 Replies

ActionScript 3.0 :: Loop Part Of Timeline 5 Times Then Continue?

Oct 15, 2010

I've been looking at other posts and trying to cobble this together, but am lost. I have a movie I need to play from frames 1-45 five times then continue from frame 50 to frame 70 and stop. on frame one I have the following script (in a layer for actions)

if (numberOfTimesToLoop<5) {
gotoAndPlay(1);
numberOfTimesToLoop++;
} else {
gotoAndPlay(50);

[Code]...

View 2 Replies

Flex :: Initialize And Make Condition For 2 Variables In Single For Loop?

Oct 28, 2010

How to initialize and make condition for 2 variables in single for loop in Flex let keep i and j are two variables

View 2 Replies

ActionScript 3.0 :: Type Error 1009 At Loop - Null Object Reference

Jul 10, 2010

I have been getting this Type Error 1009 at the following Loop:
ActionScript Code:
private function Loop(e:Event):void {
for(var i:int=0; i<walls.length; i++) {
if(hitTestObject(walls[i]) && hits > 0) {
explodeX = this.x;
explodeY = this.y;
[Code] .....

ActionScript Code:
parent.removeChild(this);
But that doesn't work. Still get the error

View 3 Replies

ActionScript 3.0 :: Condition - If The Variable Change Condition Don't Change

Sep 12, 2009

I have a BD return by PHP without problem : I have "all_good" and "no_good" If the variable change my condition don't change ..... why

[Code]....

View 3 Replies

Flash :: TypeError: Error #1009: Cannot Access A Property Or Method Of A Null Object Reference. At Videogame_fla::MainTimeline/loop()?

Feb 2, 2012

I keep getting the #1009 error coming up, i checked that everything was on my stage and was named correctly.This is the error message that comes up:TypeError: Error #1009: Cannot access a property or method of a null object reference.at Videogame_fla::MainTimeline/loop()Here is my code:

var carrot:Number = Math.floor(Math.random() * 460) +0;
var carrot1:Number = Math.floor(Math.random() * 460) +0;
var carrot2:Number = Math.floor(Math.random() * 460)+0;

[code].....

View 2 Replies

ActionScript 3.0 :: Forum FAQ (work Topic) - My Reference Is Null - Stage Is Null

Dec 19, 2009

I have begun on a list: My reference is null!Stage is null! Convert this code from as 2 to as 3 for me! Crossdomain policies are in the way of my cool idea Dynamic property names I need to use stuff on the parent! I don't want my children to scale when I scale the parent! Classes vs instances. Mod note: I do not want this topic pinned, we will use a fresh topic once we have agreed to the content.

View 9 Replies

Flex :: MessageBroker.getMessageBroker(null) Getting Null Pointer Exception?

Jun 12, 2010

I am creating Dynamic Destinations

MessageBroker broker = MessageBroker.getMessageBroker(null);
MessageService service = (MessageService) broker.getService("message-service");
MessageDestination destination = (MessageDestination) service.createDestination("Group1");

[code].....

But I am getting Null Pointer Exception

MessageBroker broker = MessageBroker.getMessageBroker(null);

View 1 Replies

Javascript :: Flash Embed Error - 'null' Is Null Or Not An Object

Jul 18, 2010

the script i wrote is working fine. but the script attached to the flash player which i have no control over is throwing a script error (im using IE8).how can i fix this? if i run it locally there is no error.

'null' is null or not an object

try { document.getElementById("").SetReturnValue(__flash__toXML(function() { return document.location.hostname; }()) ); } catch (e) { document.getElementById("").SetReturnValue("<undefined/>"); }

but this is from flash script and i dont have control over it. it just say JScript - script block.

View 1 Replies

Flex :: Clicking On Menu So That It Shows (null,null)"?

Aug 15, 2011

I have create a menu but when clicking on menu so that it shows, I get an error on the line because of the line "myMenu.show(null,null)". See function below:

private function createAndShowmyMenu():void {
myMenu = Menu.createMenu(null, myMenuDataProvider, false);
myMenu.labelField="@label"[code]........

View 1 Replies

ActionScript 3.0 :: Remove Child = Null Before Setting It To Null?

Jul 28, 2009

sometimes I remove child and trace it afterwards and it outputs null although I havent yet set it to null, why is that? and do I need to set it to null also in that case?

Code:
trace(holderArr[loadedThumbs].getChildByName("photo_bg"));
//[object MovieClip]
holderArr[loadedThumbs].removeChild(holderArr[loadedThumbs].getChildByName("photo_bg"));

[Code]....

View 13 Replies

ActionScript 3.0 :: Null Object Error That Is Clearly NOT Null

Sep 15, 2010

I have the following piece of code(part of a much bigger program). I this code I am re-using a motion that has been previously used successfully. The trace stmts are used to identify the exact location of the error and the error conditions as best I can.[code]

View 4 Replies

Actionscript 3 :: Why Is Casting Object (null) Not Null

Mar 6, 2012

When you cast null to an object using Object(null), the result is an object.When you cast undefined to an object using Object(undefined), the result is an object.But saying null as Object or undefined as Object remains null.Why is this? I can't find anything in the documentation about this.

The objects that result from these casts can have properties set on and read from them. It's as if the cast created information, or removed whatever special information the null and undefined values have. But there's no indication in the AS3 documentation that the null and undefined special types are actually objects.

View 2 Replies

ActionScript 3.0 :: Parent Is Null, Root Is Null?

Aug 7, 2010

I created a Sponsorbar which dynamically adds sponsors according a XML script.

ActionScript Code:
for each( var imgPath2:XML in xdata.img )
 {[code]...........

View 2 Replies

CS3 :: Set The Variable Value Condition?

Sep 23, 2009

I'm working under as2 with variables in a web site navigation, i want to create a condition, a simple condition, for frame controling but i'm not sure how to code it.I have the content_fade_out variable, whenever a user clicks a navigation button, the variable should be checked to see wich movie clip to play. I know i can do it with an if but, if i do it with a "if" I would need add 5 ifs to each button, while i think somethin like this can be done:

variable value = Y
y = 0
_root.home_mc.gotoandplay
y = 1
_root.galery_mc.gotoandplay....

and so on, I'm just not sure how to set the variable value condition.

View 1 Replies

Professional :: How To Add A Condition

Sep 29, 2010

I'm making a simple animation in flash, but I need to make an OR statement:

if (xxxxx or yyyyy){
}
 
this is my code, but an error appears because of the "or", I had the same problem with "AND", but it was fixed by replacing it with .

View 1 Replies

ActionScript 3.0 :: Null Object Not Null

Sep 5, 2009

I am trying to add an EventListener to a MC, but I am getting the 1009 error. My script is referencing a MC that does exist. I have verified that my code is typed correctly, and that my instance names are correct.I am creating a portfolio site. On the first frame I have my main navigation (well, it's actually not the first frame. I alpha-fade everything in so it's really the 6th or 7th, but I'm not sure how pertinent that is). The main navigation works fine (5 movie clips, fyi). Clicking them will move to a different frame, and the information and sub navigation for the frame will fade up. It is the sub navigation that I am having trouble with.[code]

As you can see, it doesn't even get to the function before it gets thrown off. I have verified that the instance names are correct. The script and the MC I am trying to add it too [I/]are[I/] in the same frame, which is what's stumping me. Normally you get 1009 when the object you're trying to reference is not there, but mine is!!Obviously there is something wrong with my EventListener. I am not sure what else do; there is a gap in my understanding of AS.

View 8 Replies

ActionScript 2.0 :: Possible To Have More Than One Condition On If Statement?

May 18, 2002

Is it possible to have more than one condition on an if statement?eg. if something is black and if it is 40cm then do the following..both conditions must be fulfilled before the action can occur.

View 3 Replies

Hit Test Inside IF Condition?

Nov 28, 2011

ive tried with this script (as2)

on (press) {
if (triggermc._visible == true) {
if (d1.hitTest(_root.d2.hit)) {

[code].....

View 5 Replies

Flex :: Specify More Than 1 Condition With && For A Property?

Sep 16, 2010

I need to specify more than one condition for visibiltyvisible="{data.allow && data.open}"However, this gives the error "The entity name must immediately follow the '&' in the entity reference."I could use a function, but I'd like to know if it is possible to do this directly with different syntax.

View 1 Replies







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