开发者

Embedded Assets in Actionscript are Flipped when Displayed!

开发者 https://www.devze.com 2023-03-20 16:20 出处:网络
Writing a small application in order to demonstrate certain functionality. I have an embedded asset being added to the stage which then has some listeners added to it so it can be dragged around. This

Writing a small application in order to demonstrate certain functionality. I have an embedded asset being added to the stage which then has some listeners added to it so it can be dragged around. This data is stored in a remote shared object so that other clients can drag the object around as well.

The p开发者_JAVA百科roblem is my object is flipped horizontally when loaded... and ideas why this is happening?

Code here: http://pastebin.com/TjegG71W


There were some bugs in Flex 4.1 around a new feature that was introduced called Layout Mirroring. Upgrading to Flex 4.5 should fix these of them and if you can't upgrade yet you can try setting the layoutDirection style to "ltr" on your Application.


Since you said this is just a demo or proof of concept, you can fix this for display until we get to the bottom of it. Add this into line 45ish where you're creating the component:

 bannerui = new UIComponent();
 bannerui.scaleX = -1;

For debugging what is going on - I have a hunch that the scaleX property is getting jacked around with at some point and getting set to -1 on one of the components. Lets try adding a listener for it and seeing what get traced to the console (add to any other parent components of the flipped image well):

line 45ish:

 bannerui = new UIComponent();
 bannerui.addEventListener( 'scaleXChanged' , onScaleXChanged );

add this method:

    private function onScaleXChanged( e :Event){
        trace( bannerui.scaleX );
    }


I was building for 4.1.0... built for 4.5.1 and it works..

fix: upgrade Flex SDK :P

0

精彩评论

暂无评论...
验证码 换一张
取 消