Hi guys,
I have a project that is raising some challenges due to the data having
to be embedded into the swf rather than read externally. I need to show
a dumb example to describe the problem, I would much rather solve it
some other way but I'm bound by some client requirements at this time.
Imagine I have a symbol names ApplicationFormSymbol and its bound to a
ApplicationForm class using
Object.registerClass("ApplicationFormSymbol', ApplicationForm);
Whenever an ApplicationFormSymbol is dropped or attached with code onto
the stage it will be instanitated as an ApplicationForm class.
So the applicationForm has a method to set a text field
public function onLoad()
{
myTextField.text = "Hello";
}
I publish this swf as page1.swf
Now lets suppose I do the same thing again, but this time the method is
public function onLoad()
{
myTextField.text = "GoodBye";
}
I publish this swf as page2.swf
So both swfs are almost the same other than they both have a copy of the
Application form class, but 1 has the "hello" and the other has the
"goodbye"
Now here is the fun part.
I now write a "loader" movie that does this
this.attachMovie("ID_BLANK", "page1", 13);
this.createEmptyClip("ID_BLANK", page2, 14);
loadMovie("page1.swf", this.page1);
loadMovie("page2.swf", this.page2);
What happens now? Well both movie display "Hello" in their text fields
as he flash VM has loaded the first copy of the ApplicationForm class
from the page1.swf file and the 2nd swf when loaded does not get its
internal ApplicatonForm class it get the one that is already registered
to the ApplicationForm symbol.
I tried removeclip, unloadclip, throwclipoutofthewindow. And once the
class is bound a symbol, any other symbol will always get the original
class.
Is there some sneaky back door around this, such as wiping out the class
reference like _global.ApplicationForm = null or
_global._package.ApplicationForm = null
???
This would be hell if someone wrote a portfolio swf viewer, where your
porfolio loads your swf files demo's you have created if any of those
swf use the same symbol/class names as any other.
I've found the classloader does not do this when a class is not bound to
a symbol, if its not bound to a symbol it will let you replace a class
in a loaded swf.
Grant.
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com