Thanks Angus. I checked my code and I am not setting width/height on the SWFLoader before setting percentHeight and percentWidth. However despite setting them both to 100% on the SWFLoaders, the loaders on all tabs apart from the first one end up with width=0 and height=0 once loaded.
Can anyone from Adobe confirm if this is a known problem? Thanks, Nick. --- In flexcoders@yahoogroups.com, "Angus Johnson" <[EMAIL PROTECTED]> wrote: > > Hi Nick, > > I don't if this will help you but one thing that I found with loaded swf's > is that if you explicitly set height and width on the loader and then > attempt to apply percentWidth or percentHeight it will fail to render. > > If i set height=100, width=100 then percentWidth=50 and percentHeight=50 I > end up with height=0 and width=100... if you follow that :). Something a bit > odd there I think but I don't fully understand how things are sized. > > So maybe your tabNavigator is applying percent measurements to a loader > where you have explicit width / height??? > > You should be able to see these properties in debug. > > hth > Angus > > > > On 15/12/06, durnelln <[EMAIL PROTECTED]> wrote: > > > > Hi all, > > > > I've been lurking on this list for a few weeks but I've now run into > > a problem and need some help myself... > > > > My application's main screen consists of a number of windows, each of > > which is a Flex application in its own right. The layout of the main > > screen is configurable from an external file which I parse at runtime > > and create the corresponding controls/sub-applications using > > Actionscript. Each sub-applications is loaded in a SWFLoaders which > > has been sized appropriately and added to the configured container. > > Once the screen is built I then tell all the SWFLoaders to load their > > content. > > > > This has all been working fine until now. What I want to do is have > > a TabNavigator on the main screen with several tabs - each tab > > containing a sub-application so that the user can flip between them. > > What I am doing is creating a SWFLoader on each tab (within a canvas) > > and setting their widths and heights to 100% (to fill the tab > > whatever its size may be). > > > > The sub-application on the first tab (i.e. the one visible at > > startup) is fine - it fills the tab as planned. However, the sub- > > applications on the subsequent tabs do not appear - UNLESS their > > widths and heights are set explicitly (e.g. width="200" > > height="100"). However this breaks my ability to change the size of > > the tabs and still have the contents fill them. Nothing changes if I > > set the TabNavigator or canvas creationPolicy to "all" either. > > > > Any ideas anyone? Is this a bug? > > > > I cannot post my entire application as it is getting pretty huge :-) > > However I have created an example application which shows a similar > > problem: > > > > <?xml version="1.0" encoding="utf-8"?> > > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" > > layout="absolute" applicationComplete="doStuff()"> > > <mx:Script> > > <![CDATA[ > > public function doStuff():void > > { > > loader1.load(); > > loader2.load(); > > loader3.load(); > > } > > ]]> > > </mx:Script> > > > > <mx:TabNavigator creationPolicy="all" x="10" y="10" > > width="500" height="400"> > > <mx:Canvas label="Tab 1: 100%" width="100%" > > height="100%"> > > <mx:SWFLoader id="loader1" autoLoad="false" > > width="100%" height="100%" source="BlueBox.swf"/> > > </mx:Canvas> > > <mx:Canvas label="Tab 2: explicit size" width="100%" > > height="100%"> > > <mx:SWFLoader id="loader2" autoLoad="false" > > width="200" height="200" source="BlueBox.swf"/> > > </mx:Canvas> > > <mx:Canvas label="Tab 3: 100% (same as tab 1)" > > width="100%" height="100%"> > > <mx:SWFLoader id="loader3" autoLoad="false" > > width="100%" height="100%" source="BlueBox.swf"/> > > </mx:Canvas> > > </mx:TabNavigator> > > > > </mx:Application> > > > > This application creates a TabNavigator with 3 tabs - all of which > > contain a SWFLoader which loads BlueBox.swf. BlueBox.swf is simply > > an empty application with a blue border and background so I can see > > how large it is once loaded (see below). > > > > Tabs 1 and 3 are identical - i.e. they both contain a SWFLoader sized > > to 100%. However the one on tab 3 does not get sized/loaded > > properly. The SWFLoader on tab 2 is very similar but its SWFLoader > > uses explicit widths and heights (which seem to work). > > > > Here is my BlueBox.swf: > > > > <?xml version="1.0" encoding="utf-8"?> > > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" > > layout="absolute" backgroundGradientColors="[#9999ff, #9999ff]" > > borderColor="#0000ff" borderStyle="solid" borderThickness="2"> > > </mx:Application> > > > > Thanks for your help (if you've managed to stay awake through all > > that!) > > > > Nick. > > > > > > >