Skip to main content
Inspiring
Oct 20, 2024 5:55 AM UTC
Answered

trying to pass a array string and not getting anywhere

clearly im too tired to be trying this or something obvious is escaping me here....

 

wanting to make an array to put the loading object into :

 

the code as it should look post the arrays dropping their data as this.....

 

 

 

var fl_MyInstance:Front_Arm_1 = new Front_Arm_1();
addChild(fl_MyInstance);

 

 

**clap and look at the arm appear**

 

(

*wHAT I NEED TO WORK*

 

var A =[Front_Arm_1];
trace(A[0]);
var fl_MyInstance:A[0] = new A[0]);
addChild(fl_MyInstance);

 

I've tried using var with "" around, thats not fixing it(its class front_arm_1 now, in quotes its just Front_Arm_1.. How i got the list generator to work and failing at this is beyond me but i guess thats luck on my part and books that have whole chapters on arrays but this....losing hair oh did i mention i haven't even TRIED the x and y coordinate arrays yet?

 

so the thing needs to grab the class, then when its trying to place the art, it also needs x and y placements as other art is going to grab a swf and replace whats in the class with new contents, but i can't even get this so far,.

 

 

This topic is closed to new replies. Start a new post to keep the conversation going.
kglad
kgladCorrect answer
Community Expert
Oct 21, 2024 6:09 PM UTC

**the file loader is working**

(from your previous solution, had to move some variables as i need B and C for x and y values  )
var ldr:Loader = new Loader();
var url:URLRequest=new URLRequest("s278.swf");
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE,LoadCompleteF);

ldr.load(url,new LoaderContext(false,ApplicationDomain.currentDomain));
function LoadCompleteF(e:Event):void{
var A = ["Front_Glasses","Back_Glasses"];
var E : Class = Class(getDefinitionByName (A[1]));
var F : Class = Class(getDefinitionByName (A[0]));

var obj:Object= new E();
addChild(DisplayObject(obj));
obj.x=100
obj.y=500
var obj2:Object= new F();
addChild(DisplayObject(obj2));
//F.x=-100 these are marked out to find this piece on the stage
//F.y=800 ""
}

note: make sure to save s278.swf and the file you save in the same folder *looks at desk* yeah...

it was a bit tricky figuring out how to get that second symbol to load but it looks like i got it so far.

 

thanks for helping on this as oddly even the mistake one for stuff in the fla is useful when i want to make a bunch of

animation sheets, thats gonna be exp handy.. drop the list of tricks, drop a list of x and y coordinates that match the array numbers and  a if/then and its done. if i get this thing to color swap the pets out, man thats gonna be a cake worthy day and the unity to swf converters are like "sorry we do not convert as3 code...please put the content on the timeline....". can i put that error ON the cake 🙂

 

 

 


you're welcome.

18 replies

kglad
Community Expert
Community Expert
Oct 20, 2024 2:18 PM UTC

the first problem is

 

var A =[Front_Arm_1];

 

that makes no sense.  you have a class name, but aren't using it correctly.  you use:

 

var A:Array = ["Front_Arm_1"];

var C:Class = Class(getDefinitionByName(A[0]));

var instance:* new C();

 

 

Translate
Inspiring
Oct 20, 2024 4:04 PM UTC

anything standing out here as a trap for the multi symbol loader? i have not yet tried external loading from a file with this, but the three  paws are different and are loading off the array. note" i did not ATTEMPT to loop this using for, so i'm aware the multiple D++'s are the not the most pragmatic way to do this , but i wanted to see it generate images before i even tried the looping. nor are the paws in any specific spot yet. more of a "is everything loading here"....

 

 

 

 

var A:Array = [Front_Arm_1,Front_Arm_1copy];
var B = [500,100];
var C = [800,300];
var D = 0;
var image :Sprite = new A[D] ();
addChild(image);
image.x=B[D];
image.y=C[D];
var image2:Sprite = new A[D++] ();
addChild(image2);
image2.x=B[D++];
image2.y=C[D++];

 

 

 

 

Translate
kglad
Community Expert
Community Expert
Oct 20, 2024 4:05 PM UTC

same mistake.  read my post.

Translate