Copy link to clipboard
Copied
Ok, i fixed the last error message, but i still cant get the xml to load, I am getting this error message now
What does this mean, I can't seem to figure it out.
I am trying to load the title of a video reel onto a button
and load a corresponding move, 1 of 4...getting this error now
ReferenceError: Error #1056: Cannot create property text on String.
at main2_fla::MainTimeline/setVids()
at main2_fla::MainTimeline/xmlLoaded()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()
this is the correspoding codeits referring to:
function setVids():void {
for(var i = 0; i < 3; i++) {
var name_txt:String = vidList_XML.vid[i + count].file;
var reelTitle = this["vid" + (i + 1)].name;
reelTitle.text = name_txt;
}
}
Copy link to clipboard
Copied
It is telling you that you can't create a property called "text" on an instance of the String class.
var reelTitle = this["vid" + (i + 1)].name;
That is assigning the name property of this["vid"+(i+1)] to the variable reelTitle. You haven't typed the variable, but "name" properties are always Strings, so reelTitle is a String.
And the String class is not dynamic, so you can't just go adding properties to it.
My guess is that you want something like this:
var reelTitle:TextField=this.getInstanceByName("vid"+(i+1))
reelTitle.text=name_txt
Or something like that....
Copy link to clipboard
Copied
its not working....i will be back in a while to work on this some more
Copy link to clipboard
Copied
he meant for you to use getChildByName():
function setVids():void {
for(var i = 0; i < 3; i++) {
var name_txt:String = vidList_XML.vid[i + count].file;
var reelTitle:TextField = this.getChildByName("vid" + (i + 1).toString());
reelTitle.text = name_txt;
}
}