Skip to main content
Inspiring
October 24, 2024
Question

how to get variables IN a loop to post their results outside the loop for use by addchild commands.

  • October 24, 2024
  • 1 reply
  • 2706 views

wondering how you do this as i'm not having good luck figuring this out.

 

 

ok i have a loader that grabs the contents of a swf and on its own, will load just fine to the stage as all of the addchild etc commands are IN the loop), problem is  as soon as separatea the two, they don't see the commands anymore. i know that stuff in a {} set is like this...and wonder how you get it out without a battle. i need to be able to access them outside the loop so the addchild commands can place them in the correct symbol with as3 name etc attached already.

 

 

 

 

 

 

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
October 24, 2024

add the loop variables as properties of objects.

Inspiring
October 25, 2024

this is where i'm having the problem spliting this at.

 

main timeline :

function LoadCompleteF(e:Event):void{
var A = ["Front_Leg_6","Back_Leg_6","Back_Leg_6"];
var E : Class = Class(getDefinitionByName (A[0]));
var F : Class = Class(getDefinitionByName (A[1]));
var G :Class = Class(getDefinitionByName(A[2]));

var obj:Object= new E();

 

 

on the symbol i'm trying to update (1 of 3)

 

addChild(DisplayObject(obj));
obj.x=100;
obj.y=500;

 

the next 2 are obj2, and 3 and no major changes.

 

it works together, but isn't letting me separate it, i know why as its all in the brackets so they only work in that section.

 

 

 

 

 

repeats for 2 and 3....

 

 

says possible undfined obj....

 

can't win for trying some days. did figure out how to store the clothing,pet profile and etc using a empty array and push command to update the array to what was selected by the user.  i win one and lose one it seems on this 🙂

 

Inspiring
October 27, 2024

you're very difficult to follow.


ok what i'm getting back on animations is the following when i put in the traces (this+id)

 

[object Front_head_Beard]Front_head_Beard
[object Front_head_Mask]Front_head_Mask
[object Front_head_FX]Front_head_FX
[object Front_Wand]Front_Wand

 

now that the symbols are tracing their code in animation, how would i push art into those classes seeing what you have so far? recall the one in the video was a precanned wireframe file, but it still had all its code attached so i figurd i would see what both ends are doing to speak as normally it has NO art and is blank, making it hard to tell waht is or isn't loading. the only code i put on the main stage is the actual motion symbols used on the game. this is also how i intend to make the viewer work as well.

 

getting the pieces to trace is very exciting as well, that means i at least got a idea whats doing what now.

what tripped me up the first time was i swore that you cannot reuse a variable...well hello classes that don't talk to each other doing so. i think its sitll obvious that i've not fully gripped the object oriented coding setup yet.