Jump to content


Photo

Arrays And Externally Loaded Swf


  • Please log in to reply
5 replies to this topic

#1 Charly Pixels

Charly Pixels

    Advanced Member

  • Members
  • PipPipPip
  • 172 posts
  • Gender:Male
  • Location:Belgium (Europe)
  • Interests:Swishmax 4 / PHP / HTML / CSS

Posted 05 December 2011 - 06:55 PM

Hi there,

I'm having a problem with let's say "one.swf" where I am using arrays. The "one.swf" works as expected and without errors in the debug, when it's playing in the internal player of SM4. When I export the "one.swf" and play it local it has the same results, no problems so far.

But when I am loading "one.swf" into a movieclip on "main.swf", then those arrays are undefined. So the calculations with the arrays are giving "undefined" as result.
I suppose that the value of the arrays is not found in that case.

I am using "this._lockroot=true" in my movie and it's exported to SWF8 with export properties "scene navigation when loaded" checkmarked.

Has somebody a clue what may cause this undefined values ?

Kind regards,
Ga nooit heen zonder praten woord of teder zijn.
Wat je 's morgens hebt verlaten kan er 's avonds niet meer zijn.

#2 bdg

bdg

    Advanced Member

  • Members
  • PipPipPip
  • 254 posts
  • Gender:Male
  • Location:USA
  • Interests:Learning through trial and error!

Posted 05 December 2011 - 08:03 PM

In the most basic of examples the following would work
child.swf(The maxArray tutorial file)
sets the random quotes in an array
then parent.swf loads child.swf and the quotes are displayed.


child.swf
onSelfEvent (load)
{
    // smt = new Array();
    smt[0] = "awesome!";
    smt[1] = "the best!";
    smt[2] = "incredible!";
    smt[3] = "amazing!";
    smt[4] = "my favourite!";
    smt[5] = "powerful!";
    smt[6] = "versatile!";
    smt[7] = "unbelieveable!";    
    message.text = "SWiSHmax is " add smt[Math.randomInt(8)]; 
}

parent.swf
onSelfEvent (load) {
    
    movieClipNAME.loadMovie("child.swf");
}

If your setup is more elaborate it may be easier to track down if we see the code

#3 cycle1500

cycle1500

    Advanced Member

  • Members
  • PipPipPip
  • 978 posts
  • Gender:Male
  • Location:Oberlin, Ohio
  • Interests:Motorcycles, hunting, camping.

Posted 05 December 2011 - 08:29 PM

Good use.
Only problem is that you need to remove the comment hashes.

.
// smt = new Array();
Wayne helps those who help them selves.

#4 Charly Pixels

Charly Pixels

    Advanced Member

  • Members
  • PipPipPip
  • 172 posts
  • Gender:Male
  • Location:Belgium (Europe)
  • Interests:Swishmax 4 / PHP / HTML / CSS

Posted 05 December 2011 - 10:10 PM

I think if the error was somewhere in my array constructions that the movie wouldn't play internally and externally without problems?

It's only when loaded into another movie that a small part does not work anymore.

Maybe somebody encoutered a similar problem and knows where to search ?

Edited by Charly Pixels, 05 December 2011 - 10:11 PM.

Ga nooit heen zonder praten woord of teder zijn.
Wat je 's morgens hebt verlaten kan er 's avonds niet meer zijn.

#5 cycle1500

cycle1500

    Advanced Member

  • Members
  • PipPipPip
  • 978 posts
  • Gender:Male
  • Location:Oberlin, Ohio
  • Interests:Motorcycles, hunting, camping.

Posted 05 December 2011 - 10:21 PM

If your setup is more elaborate it may be easier to track down if we see the code


There are a lot of evil little gremlins out there.
But a working file or a small demo so we can check it would help.

Wayne
Wayne helps those who help them selves.

#6 bdg

bdg

    Advanced Member

  • Members
  • PipPipPip
  • 254 posts
  • Gender:Male
  • Location:USA
  • Interests:Learning through trial and error!

Posted 06 December 2011 - 08:23 AM

...remove the comment hashes.

.
// smt = new Array();

Good catch Wayne,
I was trying to force error scenarios just to see
Forgot to take them out for the post.

Charley - Is the path you are using in loadMovie correct?
That might be a basic starting place.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users