Groups | Blog | Home
all groups > flash actionscript > october 2006 >

flash actionscript : Access class through SWF?



Grinshtein
10/16/2006 9:43:05 PM
I've written a class I want to let someone use, but I don't want them to have
access to the .AS file. Can I import it into a SWF and allow them to call it
that way?

Is there some other way of allowing people to use classes without giving them
the .as file?
DazFaz
10/16/2006 9:48:06 PM
This is just a guess here but because, at run time, you compile any external
..as files into the completed swf then in theory you could create an swf that
any other user could import into another swf and still be able to use the class
file within.
Grinshtein
10/16/2006 10:00:44 PM
I tried that...

I've tried creating SWF #1 with just 1 line :

import MyClass;

I compiled it and used loadMovie to put it SWF #1 into another SWF #2 - still,
I can't access my class through that SWF #2...

is loadMovie the right way to do it?
DazFaz
10/16/2006 10:08:03 PM
Now this is a real shot in the dark here as Ive never really tried it but have
you tried.

rather than import (because you have already done that in your loaded swf)
make a reference to the class like this

myloadedSwf.MyClass

Working on the principals of Object functions

Becuase you are loading the script via an already loaded swf
AddThis Social Bookmark Button