BorderContainer and percentWidth


hi

 

im trying create simple image carousel. here source code:

 

<?xml version="1.0" encoding="utf-8"?>

<s:application xmlns:fx="http://ns.adobe.com/mxml/2009"

               xmlns:s="library://ns.adobe.com/flex/spark"

               xmlns:mx="library://ns.adobe.com/flex/mx" minwidth="955" minheight="600" xmlns:local="*" creationcomplete="application1_creationcompletehandler(event)">

   

    <fx:script>

        <![cdata[

            import mx.events.flexevent;

           

            import spark.core.spritevisualelement;

           

            private var timer : timer;

            private var : int = 0;

            protected function application1_creationcompletehandler(event:flexevent):void

            {           

                timer = new timer(200,30);

                timer.addeventlistener(timerevent.timer,timerhandler);

                timer.start();

            }

           

           

            private function timerhandler(e : timerevent) : void {

                var img : spritevisualelement = new spritevisualelement();

                img.graphics.beginfill(0x00ff00,1);

                img.graphics.drawrect(0,0,100,30);

                img.graphics.endfill();

                img.x = * 105;

                i++;

                slave1.addelement(img);

                trace("master width : " + master.width.tostring() + " slave1 width : " + slave1.width.tostring() + " slave2 width : " + slave2.width.tostring());

            }

           

        ]]>

    </fx:script>

    <s:bordercontainer id="master" y="100" left="400" right="400" height="200">

        <s:group id="slave1" />

        <s:bordercontainer id="slave2" y="100" height="100" width="75%" backgroundcolor="0xff0000"/>       

    </s:bordercontainer>

</s:application>

 

point of slave2 supposed masking slave1. width of slave2 supposed 75% of master container ( background im using) width of slave1 grows when im loading images width of slave2. understand percentwidth property supposed set width % of parent containers width ( in case 75% of master containers width). how come size of slave1 affect size of slave2 though width of master container stays same?

 

i want use percentwidht because size of master container changes , want slave2(the mask) resized it.

 

cheers.



More discussions in Flex (Read Only)


adobe

Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

After Effect warning: A problem occurred when processing OpenGL commands

Preconditions Failed. - Joomla! Forum - community, help and support