保存影片剪辑和 ActionScript - Flash 共享对象 LSO
我知道可以将对象(以及所有子类、数组、字符串)保存到Flash LSO,本地到用户计算机。
是否可以保存MovieClip或函数?
我尝试使用 MovieClips 一次,但它只是将 MovieClip 的引用(指针)存储到 LSO 中,因此无法再次检索整个 MovieClip 二进制数据。
I know its possible to save an object (and all subclasses, arrays, strings) into a Flash LSO, locally to a user's computer.
Is it possible to save a MovieClip or a Function?
I tried once with MovieClips, but it just stored the reference (pointer) to the MovieClip into the LSO and therefore it was unable to retrieve the whole MovieClip binary data back again.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不可能“复制”并且不保存从 displayObject 继承的对象。
最好的解决方案是提取位图数据并将其保存并编写自己的解析器来保存塑造影片剪辑的数据。 除此之外我没有找到任何解决方案
It is not possible to "copy" and by that not to save objects that inherit from displayObject.
the best solution is to extract the bitmap data save that and write your own parser for saving data that shapes the movieclip. other than that i didn't found any solution
您需要编写自己的 deepCopy 函数版本。 此函数应该内省您的 MovieClip 并记住它的所有属性和当前状态,并使用 getQualifiedClassName() 记录类名称。 然后,您可以将所有这些信息保存到 LSO,以便稍后可以重建或复制该对象。
当你需要重构它时,你会做相反的事情。 获取 LSO,创建一个相同类型的新对象,并将其所有属性设置为您之前记录的已保存状态。
您可以研究的另一件事是将对象保存到字节数组中,但这不会保存对象的类型,并且可能会给您带来其他问题。
You need to write your own version of a deepCopy function. This function should introspect your MovieClip and remember all of it's properties and current state, as well as record the class name using getQualifiedClassName(). You would then save all that information to an LSO, so you can rebuild or duplicate the object later.
When you need to reconstitute it you would do the reverse. Get the LSO, create a new object of the same type and set all of it's properties to the saved states that you recorded earlier.
Another thing you can look into is saving the object out to a bytearray, but that will not save the type of your object, and may give you other problems.