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 🙂

 

kglad
Community Expert
Community Expert
October 25, 2024

actually they need to select it FIRST as guess whats giving the loader its filename to load. Color blue and species kaassegat for instnace literally make up the file name that starts the process. this how the oriignal game operated it. so it will need a catch for "empty" spots and send the user back "please select a color and species to continue" etc. i sense fun ahead. any ideaas why im getting issues  passing from the loader to the symbols i need though. one way or another the loader needs to pass its symbol out so i can get it into the symbol of that name. There was a strange item that was origianly there im not sure of its a clue or not  id= "name of symbol" was on the timeline of each as3 ready symbol, they all have classes etc .....all started with the same thing " id"  too. i could not trace any of the ID commands from the main part so i sense something is missing...(always came back as not defined or etc) .

i


well, have they already chosen the obj properties?