Jump to content
Search Community

Loading remote images for mobile devices?

Big Bad Roo test
Moderator Tag

Recommended Posts

Hi guys

 

Just wondering if there is a Greensock solution, or if someone can guide me to what to research for...

 

...loading and displaying a series of images from a server into mobile device native apps?

 

Like how the Facebook app loads profile images into your newsfeed?

 

Cheers

Link to comment
Share on other sites

Better question (after discovering and playing with LoaderMax), with regard to displaying a loaded remote image...

 

The display in my AIR project is set up like this...

 

- stage has been passed into my controller, and I'm setting up the main display objects like so...

 

_stage.addChild(mc);// a container mc

mc.addChild(_UI); (UI made in Flash Pro)

_UI.addChild( mySPR );   

 

The rest of my display objects are created dynamically and added to mySPR - everything displays fine.

 

I used the first sample code on the LoaderMax page https://www.greensock.com/loadermax/

 to test download a remote image off my server that I want to load into mySPR.

 

On running - it's telling me "LoaderMax 'mainQueue' is complete!", but I can't see the image.

 

With the display set-up above in mind, what do I need to change in the following lines of code to have the image appear in mySPR?

 

queue.append( new ImageLoader("https://www.mysite.com/books/mylogo.jpg", {name:"photo1", estimatedBytes:2400, container:mySPR, alpha:0, width:250, height:150, scaleMode:"proportionalInside"}) );
 

function completeHandler(event:LoaderEvent):void {
            var image:ContentDisplay = LoaderMax.getContent("photo1");
            TweenLite.to(image, 1, {alpha:1, y:100});
            trace(event.target + " is complete!");
        }

 

Is the downloaded image now in 'image'? I tried mySPR.addChild(image), but no go there either.

 

Thanks for taking a look.

Link to comment
Share on other sites

There's nothing in the code you have shown that appears like it would be causing a problem.

 

I'd suggest simplifying things a bit by taking alpha out of the equation and adding a few traces and other tests

trace(mySPR);
queue.append( new ImageLoader("https://www.mysite.c...ooks/mylogo.jpg", {name:"photo1", estimatedBytes:2400, container:mySPR, width:250, height:150, scaleMode:"proportionalInside"}) );

function completeHandler(event:LoaderEvent):void {
            mySPR.rotation = 45 //verify mySPR is accessible
            var image:ContentDisplay = LoaderMax.getContent("photo1");
            trace("image = " + image);
            image.scaleX=4; // try to do something with image
            //TweenLite.to(image, 1, {alpha:1});
            trace(event.target + " is complete!");
        }

still getting unexpected results?

 

maybe try using another container

container:mc or container:this

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...