Script Action Prototyping and Dynamic Functions

Does anyone know how the AS3 / Flash runtime works when trying to change the prototype when running between sandboxes. Specifically, I create an object O in sandbox A and then pass it to SandBox B. What is the effect if the code in sandbox B tries to change the prototype? (do you see these objects in the same class?). Can Sandbox B overwrite the public fields and methods of an object created in sandbox A (if the object is passed as a parameter)? Is it possible to create an unmodifiable class (i.e. equivalent to e.g. final in java) that can act as a ready only proxy to pass between the loaded swf and the main swf? I know the event class can use clone () to sort this and then pass events between the two swf. Is using a final class in AS3 the correct way to create proxy only,which cannot be changed at all?

+1


a source to share


1 answer


you can always use the flash.utils.Proxy class if you want a read-only proxy for some object ...

ActionScript3 is not a prototype based on 1 and 2 (you will need to compile the ecma object mode, which comes with a huge speed reduction) ...

it now has 2 inheritance mechanisms ... one is class based and the other is prototype based and only works for dynamic properties of dynamic classes ... no (i.e. not dynamic ) not a sealed property or private method of a class dynamic , can be changed at runtime ... by changing the property, I mean changing its type, or adding a setter at runtime, or overwriting it ... if the property is writable, you can of course assign something to it. ..

final only means that it cannot be subclassed ...



As far as I know, once you pass object O from sandbox A to B, the code in B can access O in much the same way as the code in does ...

I don't know if this answers the question ... maybe you could explain what exactly you are ready for ... :)

Greetz

back2dos

+3


a source







All Articles