Jump to content
GreenSock

MDiddy

ArgumentError thrown on ImageLoader

Recommended Posts

Hi I'm probably doing something wrong but I can't seem to come up with the correct way to do this. I have a timeline app that I'd like to LoaderMax because it seems like it would take a ton of the hassle out of loading all the assets necessary. I have a bunch of png slices that I compose to build out most of the visuals. There are four layers of assets that slide at slightly different rates so I grouped each layer as its own LoaderMax object. My goal was to load each part (ImageLoader) then arrange them, one after the other. Here's my problem:
















































 

When I use a width attribute with ImageLoader nodes, I get a compile error:

ArgumentError: Error #2004: One of the parameters is invalid.

at flash.display::Graphics/drawRect()

at com.greensock.loading.display::ContentDisplay/set loader()

at com.greensock.loading.display::ContentDisplay()

at com.greensock.loading.core::DisplayObjectLoader()

at com.greensock.loading::ImageLoader()

at com.greensock.loading::XMLLoader$/parseLoaders()

at com.greensock.loading::XMLLoader$/parseLoaders()

at com.greensock.loading::XMLLoader$/parseLoaders()

at com.greensock.loading::XMLLoader/_receiveDataHandler()

at flash.events::EventDispatcher/dispatchEventFunction()

at flash.events::EventDispatcher/dispatchEvent()

at flash.net::URLLoader/onComplete()

 

Is this the best practice? How can I avoid this error?

Link to comment
Share on other sites

If you're going to define a width, you must define a height as well (both or neither). You can set the scaleMode to "widthOnly" if you want to only have it squeeze/stretch the width and leave the height of the object alone, but keep in mind that ImageLoader, SWFLoader, and VideoLoader will create a ContentDisplay object immediately and if you define a width and height it will draw a rectangle accordingly so that interactive events fire properly (ROLL_OVER, CLICK, etc.) so it needs a width AND height to draw that rectangle properly.

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.
×