Image Editor sample for the 2nd FASC Conference.

The newer version of Image Editor released. – 2010/01/13

제2회 플래시 액션스크립트 카페 컨퍼런스(5월 24일)에서 발표할 이미지 에디터입니다. 컨퍼런스에 앞서 어떤 내용을 발표할지, 참석하는 분들이 미리 확인해 볼 수 있도록, SWF 파일을 공개합니다. 소스 파일은 컨퍼런스 후에 공개하도록 하겠습니다.

다음 내용들을 대충 훑어보고 오시면 이해하는데 도움이 될 것 같네요.

The Image Editor is the sample movie for the 2nd Flash ActionScript Cafe Conference(May 24th). I post it for the audience to check what will be presented at the conference. I will open the source files to the public after the presentation is over.

Before you attend the meeting, it will be helpful to go through the following topics.

このイメージエディタは二番目のFlash ActionScript Cafe Conferenceで発表しに作った物です。プレゼンテーションの前、どんなことを発表するか、皆さんに知らせるために、SWFを公開します。ソースコードは発表が終わってから公開するつもりです。

下の主題をくまなく目を通せば、発表の内容を理解し安くなると思いますけど。

  • FileReference
  • DisplayObject
  • ContextMenu
  • ByteArray
  • MouseEvent

Source Code is here: http://hangunsworld.com/blog/307

Related Links
AMFPHP Live JPEG Encoder 0.4 [ by Thibault Imbert ]
allow-http-request-headers-from tag in crossdomain.xml
Saving an image with AS3 and PHP: 3. ByteArray
Saving an image with AS3 and PHP: 2. FileReference
Saving an image with AS3 and PHP: 1. PHP
Flickr opens up for Flash
onReleaseOutside in AS3

Recently saved image.
Recently saved image.

34 thoughts on “Image Editor sample for the 2nd FASC Conference.”

  1. Alt 키도 하려면 할 수 있지만, 새로 기능 추가하려니 귀찮아서요.
    그냥 전에 만들어 둔 소스를 활용하는 선에서… ^^a

  2. 한실장님~ 용운입니다.
    어찌어찌 여기까지 오게되었네요. 다들 블로그 사용하고 계시군요.^^
    종종 찾아올게요~
    근데 명로기가 없네요~^^;

  3. This editor does not work from the source code, what necessary steps does one have to take in order for it to work ?

    At the moment i get an ‘IO error has been occured’

    Could you please explay why this is so

    Kind Regards

  4. Flash applications can not access local assets directly for the security issue. So, you need a PHP server to upload and download images.
    First, upload “uploadok.php” to your PHP server. Then, modify codes line 25 through 26 in “ImageEditor.as” file.

    If you don’t have a PHP server, no problem. I modified the source code to upload images to my Web site, hangunsworld.com, so you can test it locally. Please, download the source code and try again.
    http://hangunsworld.com/blog/307

  5. Hi there, thank you for your immediate reply from my previous question.

    Hope you r well. Could i ask a few questions?

    1. Is the source code released freely available to edit and can it be utilised to create other peices of software.

    2. I would like to know whether it is possible to do everything that is possible with the images uploaded, with text as well. i.e. is is possible to add dynamic text to the canvas and be able to edit that text, resize, move to front / back etc and also to remove that text from the canvas. Just as that which you have made possible with images?

    3. If this is possible, could you please demonstrate or send a working version of such a system to the e-mail i have provided. i.e. an example of how to add text to the canvas in the same style, maybe a text holder class in effect.

    Kind Regards

  6. Hi, Adeel Iqbal. Hope you are well, too.

    1. Yes. You are free to edit the source code and use it in other projects.
    2. Yes. It is possible to add dynamic texts, edit, resize, arrange them. But the features are not included in the cource code.
    3. Sorry. I am busy now working on other projects, so I can not add the features to it. But I think you can hire Flash developers near you to do the job.

    Best regards.

  7. Hi, I am attempting to create another application from the code provided, however I have a few compiler errors in the “ImageHandler.as” file:

    1120: Access of undefined property rotate_mc.
    1120: Access of undefined property size_mc.
    1120: Access of undefined property move_mc.
    1120: Access of undefined property rect_mc.

    I have copied these movieclips to my stage library, with no luck. I fail to understand where these movieclips have been instantiated or created. Am I missing something out? How do I get “ImageHandler.as” file to recognise these movie clips? For example in the library, there is a movieclip called “moveHandle”, how does your program know that moveHandle is actually “move_mc”. Your help is much appreciated.

    Thanks,

  8. Hi.
    You need to copy “@@ ImageHandler” movieclip stored in the “Image Handler” folder in Library. It has all of those movieclips in it. If you changed the class path, don’t forget to modify the class path in Symbol Properties too.

    Best regards.

  9. Hi again,

    I got that working now thanks very much. I also have got text fields inserted into the application.
    Is there any way that you can think of adding scrollbars to the contentHolder?

    I have attempted to use a scrollPane but it doesnt work with sprites. Am I doing something wrong?

  10. Hi.
    I think you should create TextHolder and TextHandler classes from the ImageHolder and ImageHandler. Those classes are not appropriate for handlering textfields, because they were made to control images.

    I tested the following codes, and it works good. Do you mean this?

    1
    2
    3
    4
    5
    
    var sp:Sprite = new Sprite();
    scrollPaneInstance.source = sp;
    var tf:TextField = new TextField();
    tf.text = "test";
    sp.addChild(tf);

    best regards.

    1. hello,

      i a m reading your sourcecode, but as i am no pro, i cant figure out where exactly you placed the code for adding text.

      do you have some more hints or have you found time to completely implement text functions?

      anyone else with more code snippets?

      hopefully awaiting advice
      best regards
      franky

      1. Hi, franky.
        Sorry for delayed reply. I just come back from a 5-day tour to Angkor Wat, Cambodia.

        The code above is an example adding a TextField into a ScrollPane component.
        If you want move, rotate or resize TextFileds, you’d better create new classes by modifying the ImageHolder and ImageHandler classes. I have works to do right now, so I can’t provide you with the specific codes.

        Best regards.

        1. good to hear that you survived:-).

          what a pitty, i read the code over and over but cant figure out which methods to change.
          i will try in ImageHolder.loadImage() and imageLoaded() to add a textfield with its content and selected formats. to me it seems that the methods of ImageHandler as they are apply to textfields too.

          thanks for reply
          franky

        2. Angkor Wat, nice…
          hope you enjoyed it!

          I think its actually better in many ways to create TextHolder and TextHandler classes as I did. It allows you to extend functionality and also add context menus etc…

          I’ve also added a layering function, so that the layer of the objects can be controlled, as to which object is ontop of another. However Im currently geting some errors with this, so will let you know if I get the time to fix it.

        3. Thanks guys. It was a nice experience to visit Angkor Wat.
          Actually, I also created TextHolder and TextHandler things for an other project, but I can make it public yet. It needs to be revised to open to the public. Nowadays, I have not much free time, so I can’t name the time. I’ll post it on the blog, when it’s ready.

  11. Thanks for the speedy reply.

    The TextHolder and TextHandler class idea is a good one, infact thats exactly what I did (suprise, suprise ;-) ) I just copied most of ImageHandler and ImageHolder. And it works great!

    The scrollpane was for the whole application, (i.e. to replace contentHolder), and it doesnt work properly. I want a scrollpane that will show scrollbars at all times, or when the user drags an image off the application screen:
    var sp:Sprite = new Sprite();
    sp.width = 2000;
    sp.height = 2000;
    scrollPaneInstance.source = sp;
    var tf:TextField = new TextField();
    tf.text = “test”;
    sp.addChild(tf);

    But the scrollbars refuse to come up, even though the sprite is really large.
    :(

    Any Ideas?

      1. Havent checked this blog in a long time, so sorry for the delayed response. but where you have:


        public var loader:Loader = new Loader();
        public var image:Bitmap;
        private var loaderUR:URLRequest;

        in the ImageHolder.as file, in the TextHolder.as file you would use:


        public var txtField:TextField;

        The rest of the code is also changed in a similar fashion. And in many ways the text class is easier as you dont have to worry about loading and errors etc.

        My application actually includes code to set the text to bold, italics underlined, change colours etc… this is done by having methods such as setBold(), which change the textfields bold property on and off.

        Hope that helps.

  12. Well, it seems the Sprite sp’s size does not change, because it has no contents in it. Try this.

    1
    2
    3
    4
    5
    6
    7
    8
    
    var sp:Sprite = new Sprite();
    sp.graphics.beginFill(0xFFFFFF);
    sp.graphics.drawRect(0, 0, 2000, 2000);
    sp.graphics.endFill();
    scrollPaneInstance.source = sp;
    var tf:TextField = new TextField();
    tf.text = "test";
    sp.addChild(tf);
  13. Hi Hangun,
    I have a problem uploading images to http://localhost. When I click the upload button, flash just waits for a long time without doing anything. I tried:

    flash.system.Security.allowDomain("http://localhost/")

    but it makes no difference. I know that your example on this site allows anyone to upload images, how can I do the same for my application?

    Regards,

  14. If your computer is connected to the Internet via a static IP address, you can use your IP address for users to upload images to your application run on your personal Web server. (like this http://000.000.000.000) There could be more tasks to allow users access to your application. Check manuals of your modem or router, etc.
    Otherwise, you need to use a Web hosting service.

    Best regards.

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 항목은 *(으)로 표시합니다