PDA

View Full Version : canvas height problem


Raji.S
09-17-2009, 01:12 PM
Hi,

I have a viewstack, in every index i have background, some animation as swf files and some pngs also there. when i click one object in my swf, i change the selectedindex of my viewstack. The changing is done by ‘pairedStackEffects’. All r working smoothly. The only problem is, for example, if i change viewstack index from 2 to 5 via swf object, one blank space appears. then the 5th index content will appear. likewise if i do the same process again, the blank space will not appear. so i don’t the blank space at first time. I set creationPolicy as ALL. pls help me.
For ur reference i gave the code,

//Application file

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:ind="stacks.*" xmlns:pairedStackEffects="ws.tink.flex.effects.stackEffects.pairedStackEffec ts.*" xmlns:ons="onsite.*">
<mx:Script>
<![CDATA[
public function navigateToPage():void
{
vsHome.selectedIndex = buttonNavigator.selectedIndex;
}
]]>
</mx:Script>

<mx:ViewStack id="vsHome"
x="0"
y="0"
width="100%"
height="100%" creationPolicy="all">
<ind:AboutMe id="abtme" showEffect="fade" hideEffect="fade"/>
<ind:ContactMe id="contactme" showEffect="fade" hideEffect="fade"/>
<ind:Carriers id="carriers" showEffect="fade" hideEffect="fade"/>
<ons:Onsite id="onsite" showEffect="fade" hideEffect="fade"/>

</mx:ViewStack>
<mx:TabBar id="buttonNavigator"
showEffect="Fade"
hideEffect="Fade"
itemClick="navigateToPage()">
<mx:dataProvider>
<mx:Object label="AboutMe" data="0"/>
<mx:Object label="ContactMe" data="1"/>
<mx:Object label="Carriers" data="2"/>
<mx:Object label="onsite" data="3"/>
</mx:dataProvider>
</mx:TabBar>
<pairedStackEffects:Fade id="fade" duration="1000"/>
</mx:Application>

//ContacMe file

<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%">
<mx:Image id="BgImage" width="100%" height="100%"
source="swf/background2.swf"
maintainAspectRatio="false"/>
<mx:SWFLoader id="banner"
x="100"
y="100"
height="100%"
width="100%"
source="swf/banner animation.swf"/>

</mx:Canvas>

Note:
I dont know exactly. But I found one thing. That is, if i set height & width of the canvas in ContactMe file as 100% the problem occurs, which i said. But if i set as a staic value, the error is not coming.like this,

<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="1024" height="768">
<mx:Image id="BgImage" width="100%" height="100%"
source="swf/background2.swf"
maintainAspectRatio="false"/>
<mx:SWFLoader id="banner"
x="100"
y="100"
height="100%"
width="100%"
source="swf/banner animation.swf"/>

</mx:Canvas>


pls help me. Thanks in advance

Peter Cowling
09-17-2009, 03:29 PM
Hi,

If you put you code in AS tags, you'll more likely get a response; its difficult to read right now...

Raji.S
09-18-2009, 07:00 AM
hi peter,
Sorry, i dont know to convert in AS. if u copy the code and paste it in a project, and put sample swf files. Then it will work fine.

Thanks