Forum Moderators: open
Ideally, I'd like it to load along with the commented out section of code, but in the line below that one, I even explicitly state: I WANT BUTTON-IMG1.JPG TO LOAD HERE! But it doesn't show up.
I traced the width and height after setting it, but they end up equalling 0, and I traced the positioning and they equal 300 each.
So therefore, the empty movie clip is being created, but it's not loading the image.
What's the deal?
onClipEvent(load){ }
Personally I would write a function on the main timeline
whateverclip_mc.onLoad = function() {
_root.createEmptyMovieClip("container_mc", 1);
container_mc._x= 300;
container_mc._y= 300;
container_mc.loadMovie("button-img1.jpg");
}
This was a quick 2 minute look, not checked or tested and should when whateverclip_mc loads create a new movie clip container_mc on the root timeline, position it at x and y 300 and load button-img1.jpg into it.
Was not sure if you were trying to create the container clip inside the loaded clip and if so were you trying to create a few of them (judging from the commented out code). If so its going to be a fair bit more complex.
BTW this is AS2 player 7 was not sure what platform you were trying to publish on.
I am using ActionScript 2 in MX 2004.
This code is assigned to a movie clip, "buttonImage". I am trying to load the image inside a new movie clip, "container", which will be inside "buttonImage."
Eventually, I would like the image to load dynamically, but I am trying to keep it simple for now and just load one movie clip into a specific place.
Hope that clears things up a bit.
If I just load it, it looks fine, but I'm also trying to resize it dynamically.
When I adjust either the _width, however, the image rotates 90 degrees. The width will adjust to the correct size, but the rotation was not designated. If I try to adjust both width and height in sequence, the image doesn't show up at all.
Likewise, when I try to adjust the _width and then the _rotation, the image doesn't show up anymore. Is Flash just that poor with dynamic images, or am I doing something wrong?
I am trying to adjust the container's width to be equal to that of another Movie Clip, which is being resized via frame animaiton.
onClipEvent(enterFrame){
container._width=_parent.buttonAni._width;
//container._height=_parent.buttonAni._height;
}
plus an onEnterFrame action is very processor intensive, so its better done with listeners at a quick guess.