0

我有这个应用程序:http ://www.jungle-g.co.il/#/System/

目前,当用户选择产品(例如衬衫)时,他只能制作衬衫的一侧。当用户想要编辑衬衫的另一面时,他必须完成第一面的预订,然后邀请另一面。

我的问题是我找不到如何将第一张图像保存在闪存或影片剪辑中。我的采访是为每一方用户编辑创建一个影片剪辑,仅当用户决定进行实际预订时,才发送影片剪辑中的所有图片。这可能吗?如果没有,还有其他方法吗?

我对该主题进行了研究,但没有找到可以使用它的解决方案。我找到了这个网站:http ://code.google.com/p/swfupload/ 但我不明白它对我的情况有何帮助。

感谢所有的帮助者,我为这个案子头疼了一个多月。

4

1 回答 1

0

You can create a class to hold statics of your bitmapData.

package {

    public class ShirtState
    {
        public static var ShirtFront:BitmapData;
        public static var ShirtBack:BitmapData;
    }
}

Say you have a shirt that you're editing one side of.

 var shirtFront:MovieClip; //this is the shirt you are working with.

once you are done

 var shirtFrontBitmap:Bitmap = new Bitmap(shirtFront.width, shirtFront.height);
 shirtFrontBitmap.draw(shirtFront);

once you have the bitmap you can save it to your static class

 ShirtState.shirtFront = shirtFrontBitmap.bitmapData;

you can then access it anytime in your app provided you don't reload it.

There are some caveats:

If you have a module application where individual swfs are loaded and unloaded by the DOM then you may want to use a LocalSharedObject to store your images. To do that you will have to convert the bitmap data to Base64 (I would anyways) and then store taht string in the local share object. Be mindful that object has a max file size (not sure what it is).

You don't necessarily have to store bitmaps of your shirt sides. You could create your application to create a Class for shirt and as long as an instance of it exists you can have access to both sides of the shirt.

I am not sure how you are building this app, but generally you wouldn't even need to use a static if everything is in the same context. The actual service call to deliver both sides of the shirt to a server for processing would be made at the absolute end.

于 2012-09-20T22:49:37.607 回答