Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Joost1979

loadMovie in combination with transFormManager [SOLVED]

Recommended Posts

Hi,

 

I made an MovieClip and used the function loadMovie in ActionScript, to load an image from an external location dynamically into my MovieClip.

But it seems that loadMovie doesn't work in combination with transformmanager. Is that right ? Or could anyone give me an example for doing that ?

 

Cause I've had the transformmanager working with, for example an square object converted to a movieclip, but not with an dynamically loaded image.

I tried it with transformitem aswell, but didn't work either.

 

Thanks a lot for you help,

Joost ( from Holland )

Link to comment
Share on other sites

I assume you're using the AS2 version, right?

 

Here's an excerpt from the FAQ section of the blog:

 

I'm loading an image dynamically, but it won't seem to work with TransformManager - why not?

I get this question a lot. The problem is that you're not giving Flash time enough to fully instantiate the dynamically loaded image/SWF. In order for TransformManager to work, it must be able to accurately measure the _width and _height properties, but those values aren't available until a few milliseconds after the image loads. I'd recommend either using the onLoadInit() of the MovieClipLoader or set a delayed call to a function that adds your dynamically loaded image/SWF to the TransformManager.

 

Does that help?

Link to comment
Share on other sites

I've actually tried a lot of things allready, even those delays.

Can you help me out with a short example ?

Link to comment
Share on other sites

Sorry, I'm absolutely SWAMPED with work right now. Stayed up 'til about 4am the last 5 nights working. I may have to stay up all night tonight too, so I just can't afford the time to write the code for you. But I can assure you, it's very possible to dynamically load images and use them with TransformManager.

 

If anyone else wants to chime in and help out, great.

Link to comment
Share on other sites

Could be a few things...

 

-- First of all, is your image definately loading in properly? Did you try just adding it to the stage to make sure it's not something in your loadMovie code?

-- Also, which domain are you loading your image in from. Due to security restrictions, files loaded from a server other than the one your Flash movie is on can't be mucked around with too much. You can load them (if you have permission), but you can't modify them or do anything remotely advanced with them. For example, BitmapData's draw method is a no-no. If this is the case, I'm pretty sure the cross-domain thing is what's messing things up for you.

-- Like Jack said, adding a delay will at least help you to see if that's causing the problem. I know you said it didn't help but did you try putting a really massive delay (a few seconds) on it just to make sure?

 

Hope you have some luck with this but like I said, the cross-domain thing often slips people's minds and it can be infuriating not knowing why something's not working if you're not aware of this restriction so I thought it'd be worth pointing it out for you ;)

Link to comment
Share on other sites

  • 3 months later...

Hi. I guess Joost1979 have this solved by know, but anyway I´m sharing a working code for future reference.

Best regards.

 

----------------------------------------------------------------------

this.createEmptyMovieClip("foto",getNextHighestDepth());

var mclListener:Object = new Object();

 

mclListener.onLoadInit = function(imageHolder:MovieClip) {

import gs.TransformManager;

var manager_obj = new TransformManager({targetObjects:[foto], forceSelectionToFront:false, eventHandler:onAnyEvent});

function onAnyEvent(event_obj:Object):Void {

trace(">>> "+event_obj.action+": "+event_obj.targetObject+" | transformed?: "+event_obj.transformed);

}

};

 

var fotol:MovieClipLoader = new MovieClipLoader();

fotol.addListener(mclListener);

fotol.loadClip("img/foto.jpg",foto);

Link to comment
Share on other sites

  • 4 months later...

Hi mpellegr

 

thanks for this code,

 

I am looking to share this panel in collaboration mode (like whiteboard)

 

It's possible ?

Link to comment
Share on other sites

Sorry i think my prupose isn't good. (sorry for my bad english)

 

what i need to add in your code to have a synchrozed sreen (with a rtmp server ?)

 

Tanks for your help.

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