Dynamic object layouts in Flash
I have a general Flash question. I have got 2 .SWF wrappers (Playbook and Android,that work perfectly) that takes any .SWF file and wraps it up as an application. I'm hoping to make 1 application and have it run on both the Blackberry Playbook and any Android device. Technically everything is perfect but the problem I am having is with the layout.
For example if an object is placed at x= 512 y=400 then it looks great on the Playbook but that looks horrible on an Android screen thats not 1024x800px. What I want to b开发者_C百科e able to do is something like (x=DeviceWidth/2), (y= DeviceHeight/2) so that it resizes and repositions itself automatically. An example of where I need to change the code is shown below
bt1.tween("_y", 400, 0.5, "easeOutBack");
Is this possible? If so what is the syntax for this or where can I find this info?
Thanks for your help
Regards
What Flextras said is right, you can override the updateDisplayList
function to calculate where things should go, but you're trying to use a tween (which I'm not sure why). You can also use absolute centering (horizontalCenter=0, verticalCenter=0) if you have it contained within a Group or any other absolute based container, but it won't help with the tween.
In your case, you'll probably want to do something like this:
bt1.tween("_y", (stage.height - bt1.height)/2, 0.5, "easeOutBack");
精彩评论