|
-
Hi:
I have a clip [container], inside another clip [main], which sits on the main timeline.
On the clip "main" are the following clip events and actions:
onClipEvent (load) {
_width=25;
finalW=25;
_height=25;
finalH=25;
}
onClipEvent(enterFrame){
_width +=((finalW - _width)/4);
_height +=((finalH - _height)/4);
}
Then, on a button, the following event and actions:
on (release) {
_root.main.finalW=500;
_root.main.finalH=375;
_root.main.container._x=-250;
_root.main.container._y=-187.5;
}
I am loading a movie [image1.swf] into the clip named "container." This external swf is 500x375, so, as you see above, I am positioning the clip it is loaded into [container] relative the clip container resides in [main], so that the loaded movie will be centered when loaded. So far, so good...
Here is the event and actions used to load the movie:
on (release) {
_root.main.container.loadMovie ("image1.swf");
}
Now comes the problem: Everything loads fine, centered, but the little box [see example] I put in the clip "main" rescales, and I get an unexpected animation/scaling on the loaded movie, which I don't want.
I put up a test page [only 12k total]:
http://www.ekigroup.com/baker/photographyDemo.swf
The top button will rescale the clip named "main," as expected, which contains the little box, loaded at 25x25px.
The top 2 text fields show the width and height of of "main." The bottom two, the width and height of "container." As you can see, they both end up being the same size, but the little box shrinks when "image1.swf is loaded into "container." Again, this is not what I want. What I want to do is to scale the box in the clip [main], as you see initially, then load "image1.swf" into "container," which should fit neatly INSIDE of the box.
Any ideas on why this isn't happening, and how to fix it?
Below is an example of what I want the finished product to look/act like, but I had to load the external file behind "main" in the main timeline. Unfortunately, I want to add masking later on, so this won't work:
http://www.ekigroup.com/baker/photographyDemo2.swf
BTW, the way these demos are set up, you have to click on the top button first, then the bottom button.
James
He is risen!!!
[Edited by jamescover on 09-24-2002 at 04:52 PM]
-
Anyone have any ideas?
James
He is risen!!!
-
Hi,
I made a test following your scripts & explanations. It seems in your demo that the clip image.swf is 2000 px wide. It'd work better if the swf was 500x375.
Plus i'm wondering if you shouldn't go with _xscale and _yscale instead of width.. at least for your textfields, testing wise...
It seems my test works like the demo2 (or so, I did it fast, not really placing clips on exact coords..) and i used a 500x375 image.
gparis
[Edited by gparis on 09-24-2002 at 08:49 PM]
-
Hi gparis:
"image1.swf" is 500x375. I just checked it, again, to make sure. I don't know why I'm getting that strange scaling when it first loads.
This is the path to my clip:
_root.main.container
As already noted, I dynamically scale "main" then load "image1.swf" into container. The results are what you see in the first demo.
Are you saying that you got the results in demo 2 by doing what I described in demo 1???
James
He is risen!!!
-
yes. The box scales and the image loads in. You want my crappy test.fla? :)
gparis
-
Hi gparis:
Could you tell me what steps you took, because I did another test with a new movie, but got the same results?
There is nothing in the movie except 2 buttons and two clips:
One clip is named "main," and the other "container."
There is nothing in "container" except a stop action in frame 1.
In "main" there is just a 25x25px square.
"container" is nested inside of "main," which resides on the main timeline, with the following actions attached to it [attached to "main," that is]:
onClipEvent (load) {
_width=25;
finalW=25;
_height=25;
finalH=25;
}
onClipEvent(enterFrame){
_width +=((finalW - _width)/4);
_height +=((finalH - _height)/4);
}
Then, I have 2 buttons on the main timeline. On the first button is this action:
on (release) {
_root.main.finalW=500;
_root.main.finalH=375;
_root.main.container._x=-250;
_root.main.container._y=-187.5;
}
On the second button this:
on (release) {
_root.main.container.loadMovie ("image1.swf");
}
I even made a new "image1.swf." The movie is 500x375 px. The image is the exact same size. Any idea what I'm doing wrong? The second button does nothing to change the finalW/finalH of "main," so I don't know why it is rescaling.
Thanks for your help so far.
James
He is risen!!!
-
"In "main" there is just a 25x25px square."
not in mine. I put a 500 x 375 square which resizes on(load) to 25x25 (following the onLoad clipEvent instructions)
That would not change the resizing though.. Give me your email, i'll zip&send you my test+loaded clip
gparis
-
Hi:
Okay, well that's the problem. I changed the size of the square, and everything works as expected. Problem is, I want to load several different sized external swf into "container." So, I will need to resize "main" for every external swf. That means that the size of the square would have to be the same size as each loaded swf before it is rescaled, and that won't work.
And I don't like the idea of using _x/_yscale, because it's too approximate. I need exact or near exact pixel dimensions.
So, how can I do this? I want a reusable, empty clip [container], but it has to be nested inside of "main," because main will contain a background of sorts, along with some masking applied to whatever is loaded into "container."
Thanks for your help. No need to email now, but I appreciate the offer.
James
He is risen!!!
-
ok i see.. I don't know how many pics you've got but i smell "array" .. Anyway that square is just a shape that actually gives the size of main. So use a transparent shape instead to give main a width & height then use a movieclip for that box that you may resize following an array of w/h according to your swfs dimensions..
makes sense?
gparis
-
Well, I smell "lazy," 'cause I think I'm going back to my second idea of just layering "container" behind "main" in the main timeline 
Thanks for your help in getting this sorted, gparis.
James
He is risen!!!
-
you're welcome, jamescover.
gparis
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|