A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Sharing classes between multiple swf files

  1. #1
    crossconscious
    Join Date
    Sep 2005
    Location
    Belgium
    Posts
    1,188

    Sharing classes between multiple swf files

    Hi,

    Let's suppose I have a main.swf, which loads sub.swf, and both of them have a MyClass.as with some static variables - for instance, like this :

    PHP Code:
    class {
        public static var 
    var1:Number;
        public static var 
    var2:Number;

    Now, both swf files have their own version of this class - if I change var1 from main.swf, sub.swf won't be able to see this change.

    I know this can be done in AS3 (using ApplicationDomain I think), but is there a solution in AS2?

    I need this for my login system, I have a User.activeUser variable which is a reference to, well, the current logged in user.

    One solution would be to do _root.User=User (from within my main.swf), and then use _root.User in my sub.swf, but that's a pretty dirty hack-like solution. I know there must be something a bit more elegant.


    Thanks!

  2. #2
    crossconscious
    Join Date
    Sep 2005
    Location
    Belgium
    Posts
    1,188
    bump

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