• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Error #1056: Cannot create property text on String.

New Here ,
Mar 14, 2010 Mar 14, 2010

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;
        }
}

TOPICS
ActionScript

Views

3.5K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 14, 2010 Mar 14, 2010

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....

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 14, 2010 Mar 14, 2010

Copy link to clipboard

Copied

its not working....i will be back in a while to work on this some more

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 14, 2010 Mar 14, 2010

Copy link to clipboard

Copied

LATEST

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;
        }
}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines