A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: fade external image

  1. #1
    Junior Member
    Join Date
    Mar 2011
    Posts
    15

    fade external image

    Hi

    Can anyone help me with fading in external images into the movie clip please?

    Here is my code:

    Code:
     function loadImage(url:String):void {
                        imageLoader = new Loader();
                        imageLoader.load(new URLRequest(url));
                        imageLoader.contentLoaderInfo.addEventListener(ProgressEven t.PROGRESS, imageLoading);
                        imageLoader.contentLoaderInfo.addEventListener(Event.COMPLE TE, imageLoaded);
              }
              loadImage("imgs/" + pic + ".jpg");
     
     
             function imageLoaded(e:Event):void {
                        if (pic_mc.loadedImage) {
                        pic_mc.removeChild( pic_mc.loadedImage );
                        }
                        pic_mc.loadedImage=imageLoader;
                        pic_mc.addChild(imageLoader);
              }

    Many thanks
    Last edited by pcmac; 02-27-2013 at 06:41 AM.

  2. #2
    Senior Member realMakc's Avatar
    Join Date
    Oct 2002
    Posts
    927
    using TweenLite that could be TweenLite.from (imageLoader, 2, {alpha: 0 }); iirc
    who is this? a word of friendly advice: FFS stop using AS2

  3. #3
    Junior Member
    Join Date
    Mar 2011
    Posts
    15
    Quote Originally Posted by realMakc View Post
    using TweenLite that could be TweenLite.from (imageLoader, 2, {alpha: 0 }); iirc
    Any chance you can help me further with this please? When I tried fading in the image, it faded in the movie clip just the once.

    Many thanks looking forward to hearing form you.

  4. #4
    Senior Member realMakc's Avatar
    Join Date
    Oct 2002
    Posts
    927
    you need to put it at the end of imageLoaded, I think
    who is this? a word of friendly advice: FFS stop using AS2

  5. #5
    Junior Member
    Join Date
    Mar 2011
    Posts
    15
    Is there a way to find out what class needs to be imported for my script to work?

    I am getting a type error for this line of code:
    Code:
    var TweenTarget:DispayObject=e.target as DisplayObject;
    I have imported:
    Code:
    import flash.display.DisplayObject
    This is the error:
    Code:
    1046: Type was not found or was not a compile-time constant: DispayObject.
    Any ideas?

    Thanks

  6. #6
    Senior Member realMakc's Avatar
    Join Date
    Oct 2002
    Posts
    927
    what you really need is good code editor like flashdevelop or fdt you missed L in Disp_ayObject.
    who is this? a word of friendly advice: FFS stop using AS2

  7. #7
    Junior Member
    Join Date
    Mar 2011
    Posts
    15
    Quote Originally Posted by realMakc View Post
    what you really need is good code editor like flashdevelop or fdt you missed L in Disp_ayObject.
    Lol oh my god.thanks realMakc you've really helped me out today. Thanks a lot!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center