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

ReferenceError: Error #1056: Cannot create property 0 on Number.

New Here ,
Sep 05, 2010 Sep 05, 2010

Hi, I have an AS3 script that calls an XML but when compiling I get this error

ReferenceError: Error #1056: Cannot create property 0 on Number.
at mod::ML/parseData()
at mng::DM/onXMLLoaded()

Here are some snippets

the first script that defines the XML

        private function addedToStageHandler(event:Event = null) : void
        {
            var _loc_2:* = Application.getInstance();
            Application.xmlPath = "xml/soc.xml";
            _loc_2.initialize(this);
            return;
        }

here is the ML one

    public class Model extends EventDispatcher implements IModel
    {
        public var social:Social;

        public function Model()
        {
            return;
        }

        public function parseSocialData(param1:XML) : void
        {
            this.social = new Social(param1);
            this.socialSection.social = this.social;
            return;
        }

        public function getSectionData(param1:String) : Absec

        {
            var _loc_2:Absec = null;
            switch(param1)
                case "SocialSection":
                {
                    _loc_2 = this.socialSection;
                    break;
                }

            return _loc_2;

        }

        public function parseData(param1:XML) : void
        {

            this.socialSection = new SocialSection(XML(_loc_3));
            var _loc_4:int = 0;
            var _loc_5:* = xml.sections.section;
            var _loc_3:* = new XMLList("");
            for each (_loc_6 in _loc_5)
            {
               
                var _loc_7:* = _loc_5[_loc_4];
                with (_loc_5[_loc_4])
                {
                    if (@id == "SocialSection")
                    {
                        _loc_3[_loc_4] = _loc_6;
                    }
                }
            }

         }

here is the DM one

        private function onXMLLoaded(event:Event) : void
        {
            var _loc_2:* = new XML(event.target.data);
            this.model.parseData(_loc_2);
            dispatchEvent(new Event(XML_LOADED));
            return;
        }

and the XML

  <section id="SocialSection" active="true" visible="true" default="false">
   <name><![CDATA[<font size="50">SOCIAL</font>]]></name>
   <title><![CDATA[<font size="25">SOCIAL</font>]]></title>
   <forums>
    <line1><![CDATA[<font size="10">POST ON THE</font>]]></line1>
    <line2><![CDATA[<font size="18">FORUMS</font>]]></line2>
    <rollover><![CDATA[<font size="10">Have questions? Click here.</font>]]></rollover>
    <url>link_to_forum</url>
   </forums>
  </section>

I think the issue is _loc_4 but not sure how to fix this. Thanks!

TOPICS
ActionScript
5.7K
Translate
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 ,
Sep 05, 2010 Sep 05, 2010

click file/publish settings/flash and tick "permit debugging".  retest.  the problematic line number will be in the error message.

Translate
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 ,
Sep 05, 2010 Sep 05, 2010

Hi, thanks for your reply. I did as you suggested and the error is here for ML

                        _loc_3[_loc_4] = _loc_6;

and here for DM

            this.model.parseData(_loc_2);

And it's more cryptic than before : ). I think the DM error is predictable because of the first one

The complete error list is

ReferenceError: Error #1056: Cannot create property 0 on Number.
at mod::ML/parseData()
at mng::DM/onXMLLoaded()

at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()

again, I think everything starts with ML script error

Thanks!

Translate
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 ,
Sep 05, 2010 Sep 05, 2010

why are you executing:

var _loc_3:* = new XMLList("");

Translate
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 ,
Sep 05, 2010 Sep 05, 2010

ashamed to say, I'm learning, these scripts are copy paste from various

tutorials.blogs and friends, and I don't get everything, how it interacts

together

as a side note, I replaced loc4 from 0 to 1 and I get this error

ReferenceError: Error #1069: Property fileURL not found on Number and there is

no default value.

Thanks!

Translate
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 ,
Sep 05, 2010 Sep 05, 2010

delete that line.      _loc_3 must already be defined somewhere or else this line:

this.socialSection = new SocialSection(XML(_loc_3));

would cause an error.

Translate
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 ,
Sep 05, 2010 Sep 05, 2010

that's an ingenious catch :). anyways, now I get

ReferenceError: Error #1069: Property fileURL not found on Number and there is

no default value.

for this code

            this.titleTreatment = loc3.fileURL.toString();

and this one

            this.globalElements = new GlobalElements(XML(_loc_3));

this starts to be more complex than I can chew, so I should learn some more AS3

and grow up and try again.

Thanks!

Translate
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 ,
Sep 05, 2010 Sep 05, 2010
LATEST

you're welcome.

Translate
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