A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: Loading jpg form external site, not working on server

  1. #1
    Senior Member
    Join Date
    Jun 2003
    Location
    La Mirada California
    Posts
    396

    Loading jpg form external site, not working on server

    I'm trying to load a jpg from youtube.com. I load if from my computer, it works.. load it online, doesn't. And it doesn't give me any errors or anything. The completeListener is not working! Is there a problem with flash loading from other domains or what?.. If I test it, it shows in Safari's activity that the jpg was loaded, but it won't display it.

    Here's my code:
    Code:
    var iconLoader:Loader;
    function loadThumb(){
    	iconLoader = new Loader();
    	iconLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, completePhotoListener);	
    	iconLoader.load(new URLRequest("http://img.youtube.com/vi/8M69nCOJnuk/1.jpg"));
    }
    
    function completePhotoListener(e){
    	iconLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE, completePhotoListener);
    	var _image:Bitmap = Bitmap(e.target.content);
    	container.addChild(_image);
    }
    
    loadThumb();
    I tried doing error handling, but there's no errors! what in the world!

  2. #2
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    Where do you have addChild(iconLoader); ? You need to add that or it won't work.
    - The right of the People to create Flash movies shall not be infringed. -

  3. #3
    Senior Member
    Join Date
    Jun 2003
    Location
    La Mirada California
    Posts
    396
    I'm using this:

    var _image:Bitmap = Bitmap(e.target.content);
    container.addChild(_image);


    The weird thing is, it works on my computer, but not on the server, even though Safari shows the photo loaded. Also, when i use event listeners and have them output on a textfield online, it appears the complete listener isn't doing anything.

  4. #4
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    You need to add the Loader object or it won't work.
    - The right of the People to create Flash movies shall not be infringed. -

  5. #5
    Senior Member
    Join Date
    Jun 2003
    Location
    La Mirada California
    Posts
    396
    within the complete listener, or before?... I'll try, but it doesn't even seem to use the complete listener..

  6. #6
    Senior Member
    Join Date
    Jun 2003
    Location
    La Mirada California
    Posts
    396
    ahh, you are amazing! it worked!...

  7. #7
    Senior Member
    Join Date
    Jun 2003
    Location
    La Mirada California
    Posts
    396
    why did that work on my comp and not online then?

  8. #8
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    Quote Originally Posted by brentW505 View Post
    why did that work on my comp and not online then?
    Don't know. However, just follow the standard protocol sometimes and it will work.
    - The right of the People to create Flash movies shall not be infringed. -

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