A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: accessing class with loadmovienum...

  1. #1
    Junior Member
    Join Date
    Sep 2001
    Posts
    11

    accessing class with loadmovienum...

    HI,
    I need to build a project that will have a main.swf calling many other swf. I don't want to have to rebuild my main swf every time I change a line of code so that's why I want to have one swf that will contain all my classes(objects). So lets say I have in class.swf:

    Test=function()
    {
    this.x=5;
    this.y=7;
    }

    If I use loadMovieNum("class.swf",1)in call.swf, can I instantiate this?????

    inst=new Test(); //doesn't work
    inst=new _level1.Test();//doesn't work

    Anyone have a clue?????

    Thanks
    Bono

  2. #2
    Poof! Whaddya need? I'mFine's Avatar
    Join Date
    May 2001
    Posts
    345

    #include?

    Have you thought about creating a text file containing all of the ActionScript for your main swf? You can actually "import" the ActionScript into your movie at runtime.

    the script that "loads" the script is

    Code:
    #include ("myScript.as")
    Macromedia suggest giving the text file the extension ".as" -- which seems to be a good way of keeping things organized. Just make sure the text file containing your external script is in the same folder as your main swf, or change the filename to include the correct path.

    Nice, huh?
    True genius consists of the ability to work around one's shortcomings.

  3. #3
    Junior Member
    Join Date
    Sep 2001
    Posts
    11
    Thanks!

    System.useCodepage=true;
    #include "class2.as"

    works like a charm
    Bono

  4. #4
    Poof! Whaddya need? I'mFine's Avatar
    Join Date
    May 2001
    Posts
    345

    glad

    Yay! I got one right!

    Feels like Alex Trebek ought to be giving me a check or something.

    True genius consists of the ability to work around one's shortcomings.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center