
June 23rd, 2005
01:43 AM
Neverside Newbie
Status: Offline!
Drag object and load a .gif image
Hi,
I have MovieClip named mc_angry and its an empty MC. I use this to load a image into it
unloadMovie(mc_angry);
loadMovie('path/image.jpg', mc_angry);
Works great, but when i want to load a .gif image, it doesn't work.
I also want the loaded image to be dragable, but this doesn't work
mc_angry.onPress = function(){
startDrag('mc_angry');
}
mc_angry.onRelease = function(){
stopDrag();
}
Why doesn't that work?
Thanks, Dexx
___________________
| Lunar Poll | Dexxaboys Site |

June 23rd, 2005
09:15 AM
last time i checked you could only load non-porgressive jpgs into a flash player... you might want to double check.
Last edited by fmx, June 23rd, 2005 09:16 AM (Edited 1 times)

June 24th, 2005
06:23 PM
Neverside Newbie
Status: Offline!
Okay, but why doesn't my "drag" script work?
The names for the objects is correct.
___________________
| Lunar Poll | Dexxaboys Site |

June 25th, 2005
08:52 AM
Neverside Newbie
Status: Offline!
when loading an item into a movie clip, that movie clip will lose attached event handlers (like onPress, onRelease, etc).. to get around that, you'll have to create a container clip inside your container clip so to speak and load your .jpg into the inner container but keep the outter container for button events.. This is what the help file says:
Example
As shown in the following example, you can use loadMovie() to load the image picture.jpg into a movie clip and use the MovieClip.onPress() method to make the image act like a button. Loading a JPEG using loadMovie() replaces the movie clip with the image but doesn't give you access to movie clip methods. To get access to movie clip methods, you must create an empty parent movie clip and a container child movie clip. Load the image into the container and place the event handler on the parent movie clip.
// Creates a parent movie clip to hold the container
this.createEmptyMovieClip("logo_mc", this.getNextHighestDepth());
// creates a child movie clip inside of "mc_1"
// this is the movie clip the image will replace
logo_mc.createEmptyMovieClip("container_mc",0);
logo_mc.container_mc.loadMovie("http://www.macromedia.com/images/shared/product_boxes/80x92/studio_flashpro.jpg");
// put event handler on the parent movie clip mc_1
logo_mc.onPress = function() {
trace("It works");
};
___________________
obod | weapons of mass dysfunction