-
Keep object in stage center while scrolling
I have a situation where i have a horizontal scrolling container that has a video object inside it. the video object has to stay inside the scrolling content for another reason i don't want to get into here. Now the client wants me to keep the video in the center of the stage even when the clip its inside of is scrolling. Normally I would just take it out of the scrolling clip and place it above the scrolling content but i cant do that here.
I tried this math but it didn't work exactly.
on an enter frame when the video is open I have this code;
Actionscript Code:
if( vid ) vid = ( stage.stageWidth/2 - vid.width/2) - scrollingContainer.x;
-
I tried a simple test of your math and it works just fine. What exactly is vid? maybe your code isn't moving the vid properly. Like maybe you need to put in vid.x because everything after vid= I think is just perfectly fine.
-
Ah I missed typed yes it should be vid.x. It works for me when I test it in another file but in my movie its not working correctly.
I found another way around it which worked out for me. I took it out of the scrolling move and added some scaling Math to it separately.
Thanks for the help and testing the code.
-
if you show more code maybe I can help you figure it out better. I mean what exactly is the setup. I suppose unless it's a big project...
-
Thanks swak, Yea the project is way to big to post. At Least I Know my code works. Thanks for the help
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
|