AS2 舞台尺寸检测/调整尺寸时重新定位 MC框架改变?
创建一个全屏显示的网站,那里没有戏剧性。
我面临的唯一问题是,如果您调整窗口大小,然后单击新菜单,项目的编程定位:即:
contactheader._x = Stage.width / 2 - 252;
contactheader._y = Stage.height / 2 - 264;
不会启动,直到您通过再次调整窗口大小将其“撞”到位。请参阅此处的实例以及查看问题的步骤:
项目文件此处:http://flash.pcfuse.com/mySite.zip
我该怎么做才能阻止忽略自己的物品程序化定位??
谢谢你
Creating a website which is staged as fullscreen, had no dramas there.
The only problem I'm facing is if you resize the window, then click to a new menu, the programmatic positioning of items: ie:
contactheader._x = Stage.width / 2 - 252;
contactheader._y = Stage.height / 2 - 264;
does not kick in, until you 'bump' it into place by resizing the window again. See here for live example with steps to see the problem:
Project files here: http://flash.pcfuse.com/mySite.zip
What can I do to stop the items from ignoring their own programmatic positioning??
Thankyou kindly
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
知道了 ;)
Got it ;)
我认为您可能遇到的问题是,当您转到 Flash 应用程序的不同部分时,您要添加一个事件侦听器,以便在调整大小时正确定位显示对象。然而,在实际进入该部分时,您并没有对这些对象进行任何动态定位。
澄清一下,当 Flash 片段首次加载时,它会获取舞台的高度和宽度,在这些计算中放置对象,然后放置在那里。当您单击选项卡时,它不会重新加载这些对象并重新定位它们,因为它是在应用程序首次启动时执行的。一旦您开始调整 swf 的大小,它就会将它们弹出到位,因为这就是 onresize 事件应该做的事情。
我建议编写一个函数来定位每个部分中的对象,然后每当您单击要通过单击选项卡打开的特定部分时调用它,然后还从 onresize 事件内部调用该函数。
I think the issue you might be running into is that when you are going to the different sections of your flash application, you are adding an event listener so that your display objects are positioned correctly on resize. However you are not doing any dynamic positioning of these objects upon actually going to that section.
To clarify, when the flash piece first loads, it grabs the stage height and width, does it's object placement on those calculations and then sits there. When you click on the tabs, it's not reloading those objects and repositioning them because it did so when the application first started. It will pop them into place once you start to resize the swf, because that is what the onresize event is supposed to do.
I'd suggest writing a function that does the positioning of the objects in each section, then have it called whenever you hit that specific section you want opened from clicking on a tab, then also call that function from inside the onresize event.
试试这个:
如果在任何时候你想阻止它更新其位置,请使用:
Try this:
If at any point you want to stop it from updating its position use: