Hi,
 
I know about this listener problem but I'll try other solution as soon as possible...
 
Tks....

 
On 3/23/06, inawire <[EMAIL PROTECTED]> wrote:
Thanks Bruno and Doug,

This is on the right track (though I still do not know why this
worked in beta 1 with out all this extra code).

Bruno, your code worked for me fine (flex 2 version of Doug's idea).
When I load my inner app, the content resizes perfectly (see inner
app below).

The only trouble I am having now it a basic problem that anyone could
probably help me with. The event listener for the 'resize' is still
being called from the shell when I try to load a second inner app. I
have been trying to use removeListener but do not seam to find an
event that lets me know when the first inner app is being removed (or
unloaded). I have tried to call unload() on the instance of the
Loader app in the shell app and keep getting the error
'Call to a possibly undefined method 'unLoad' through a reference
with static type 'mx.controls:Loader '

Is there an event I can make the inner app listen for that tells me
that it is being removed  when I load a new inner app (or is it being
removed)?

Thanks Ross

P.S.
Bruno, as for your question, using your code and the fact that my
inner apps scale using the layout anchors, I did not have to talk to
the inner app from the shell app. I have tried using the
LoaderInstanceName.content.propertyInInnerApp and I can not get
around the same compliler error as stated above.

Thanks for your help.




Code for sample inner app the resizes to fit
==========================================
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" mlns="*"   
layout="absolute" width="100%" height="100%"
creationComplete="initApp();"
paddingBottom="0" paddingLeft="0" paddingRight="0" paddingTop="0"
      >
<mx:Script>
  import flash.util.trace;

     
  private function resizeLoader(event:Event = null):void
  {
    width = parent.parent.parent.width;
    height = parent.parent.parent.height;
  }
 
  public function unLoader():void
  {
    trace('unLoader called')
    parent.parent.parent.removeEventListener("resize", resizeLoader);

  }    
       
  private function initApp():void
  {
    resizeLoader();
    parent.parent.parent.addEventListener("resize", resizeLoader);
  }
</mx:Script>

<mx:Canvas left="0" right="0" top="0" bottom="0" id="main">
<mx:DataGrid id="dg" left="0" top="0" bottom="0" right="0">
<mx:columns>
  <mx:DataGridColumn headerText="Column 1" dataField="col1"/>
  <mx:DataGridColumn headerText="Column 2" dataField="col2"/>
  <mx:DataGridColumn headerText="Column 3" dataField="col3"/>
</mx:columns>
</mx:DataGrid>
</mx:Canvas>
</mx:Application>
============================================================





--- In flexcoders@yahoogroups.com, "Bruno Martins" <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I did a poor solution to this problem but I believe that is a start
to solve
> the problem:
>
> I put the following code in the application that will be loaded:
>
>      private function resizeLoader(event:Event = null):void
>      {
>           width = parent.parent.parent.width;
>           height = parent.parent.parent.height;
>      }
>
>      private function initApp():void{
>          resizeLoader();
>          parent.parent.parent.addEventListener("resize",
resizeLoader);
>       }
>
> onCreationComplete execute the initApp()...
>
> I try to create a AppLoader component extend the loader and adjust
the
> content after the complete event but I don't know how to access the
content
> proprieties, if some one know how to change the content properties
please
> let me know...
>
> Tks...
>
> On 3/22/06, Doug Lowder <[EMAIL PROTECTED]> wrote:
> >
> > I know in 1.5 the trick was to provide the loaded (inner) app with
> > getPreferredHeight() and getPreferredWidth() functions; may be
worth a
> > try in your case if you are able to modify the code for the loaded
> > apps.  In AS2, it was:
> >
> > function getPreferredHeight() {
> >     return _parent? _parent.layoutHeight :
super.getPreferredHeight();
> > }
> >
> > function getPreferredWidth() {
> >     return _parent? _parent.layoutWidth : super.getPreferredWidth
();
> >
> > }
> >
> > --- In flexcoders@yahoogroups.com , "inawire" <ross@> wrote:
> > >
> > > With further testing, the loaded (inner) app
(application.width) is
> > > scailing to the correct size on initial load. When the outer
shell
> > > resizes, the inner app resize does not get called (it does when
it
> > > runs on its own).
> > >
> > > Also when the inner app first loads, thought the inner app is
showing
> > > the correct width available, the inner content does not scale to
> > > fit available size of the inner app.
> > >
> > > Does anyone have any ideas?
> > >
> > > Ross
> > >
> > >
> > >
> > >
> > > --- In flexcoders@yahoogroups.com, "Bruno Martins" <bheman@>
wrote:
> > > >
> > > > I had the same problem, but I don't fix yet.
> > > >
> > > > On 3/21/06, inawire <ross@> wrote:
> > > > >
> > > > > Hi
> > > > >
> > > > > I just converted my app to Beta 2. Ran the conversion
scripts,
> > > switch
> > > > > layout constraintes, changed LinkBar click to itemClick
(that got
> > > > > me),worked through some new warnings that were not present
before.
> > > > > Everything works fine now ... but (always a but)
> > > > >
> > > > > I'm loading other Flex apps into a shell Flex app. I had the
> > > loaded
> > > > > apps expanding to fill 100% of the available space. The
shell app
> > > has
> > > > > a top control panel, a bottom status bar and the rest is
left to
> > > the
> > > > > following code (below) to fill out the middle. In Beta 1,
the apps
> > > > > would load into the shell and expand to fit the available
> > > > > width/height. Now when I load the apps they come in as
500x375.
> > > The
> > > > > apps on their own fill the browser window. Also, if I set
the
> > > apps to
> > > > > be say 600 wide, they will come in 600 wide (loader will
expand to
> > > > > fit).
> > > > >
> > > > > Something has changed, does anyone have any ideas?
> > > > > Is this related to the issue:
> > > > > "Resize effect problems The Resize effect doesn't work with
layout
> > > > > constraints." (from known issues)
> > > > > If so is there a workaround?
> > > > >
> > > > > Thanks
> > > > >
> > > > > Ross
> > > > >
> > > > > -----------------------------------------
> > > > > Code from shell app that loads sub apps.
> > > > > ...
> > > > > <mx:HBox width="100%" height="100%" borderStyle="solid"
> > > > > cornerRadius="5" styleName="colorPanel"
dropShadowEnabled="true"
> > > > > horizontalGap="0">
> > > > >   <mx:VBox width="100%" height="100%">
> > > > >     <mx:Loader
> > > > >         height="100%"
> > > > >         width="100%"
> > > > >         id="applet"
> > > > >         minHeight="400"
> > > > >         minWidth="354"
> > > > >         source="{app}"
> > > > >         scaleContent="true"
> > > > >         complete="doneLoading()"
> > > > >         showBusyCursor="true"
> > > > >         />
> > > > >   </mx:VBox>
> > > > > </mx:HBox>
> > > > > ...
> > > > >
> > > > >






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS






--
Bruno Gustavo Martins
Mobile: (55)(11)9585-9587
[EMAIL PROTECTED]
experience everywhere
http://www.dclick.com.br/blog


--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




YAHOO! GROUPS LINKS




Reply via email to