Gustavo:

Sorry, but I don't think you're coding this correctly. Specifically:

1) I don't see your browser size detection code in the HTML wrapper
file at all. E.g., it is missing:

> <script type="javascript>
> 
> var browserHeight= screen.availHeight;
> var browserWidth = screen.availWidth;
> 
> </script>

2) In any case, I'm not 100% clear as to what you are trying to
accomplish via the external interface. However, to get the available
screen width the following code will *probably* work (I haven't tried
it or tested it):

In ActionScript (note the quotation marks):
var width:Number = ExternalInterface.call("getAvailWidth");


assuming you have a JS function (in the HTML wrapper file) like this:

function getAvailWidth()
{
     return screen.availWidth;
}


Then write similar code for the height, etc.


3) BTW, as a general rule, I've found it most productive to debug JS
code first (in isolation), _before_ attempting to call it from Flex.

4) Please look at the Adobe documentation for the ExternalInterface
API and the HTMLWrapper file again. I think--for now--you've reached
the limit as to what can reasonably be addressed via postings on
FlexCoders.

Good luck,
Jim

--- In flexcoders@yahoogroups.com, Gustavo Duenas LRS <gdue...@...> wrote:
>
> OK,,I have this using the external interface let me know if I'm  
> wrong...:)
> 
> <mx:script>
> import flash.external.*;
> 
> publicFunction resizerFlash():void{
> 
> var h:uint;
> var w:uint;
> 
> if (ExternalInterface.available){
> 
> var availableHeight:uint = "browserHeight" ;
> h= ExternalInterface.call(availableHeight, stage.height);
> }
> 
> if (ExternalInterface.available){
> 
> var availableWidth:uint = "browserWidth";
> w=ExternalInterface.call(availableHeight, stage.width);
> 
> }
> 
> }
> in the html:
> 
> <script type="javascript>
> 
> var browserHeight= screen.availHeight;
> var browserWidth = screen.availWidth;
> 
> </script>
> 
> I'm just adapting something I found about using the external  
> interface....
> let me know if I'm wrong or this is going to be a fiasco....
> 
> 
> Gustavo
> 
> 
> On Feb 2, 2009, at 1:33 PM, Gustavo Duenas LRS wrote:
> 
> > Ok, jim, my flex ste:
> >
> > is:
> >
> > http://leftandrightsolutions.com/lrsad/bin/lrsad.html
> > please check it on a pc with windows and let me know if this one  
> > looks good on windows/vista/xp borwsers,
> > prefenrently IE.
> >
> > Regards,
> >
> > Gustavo
> >
> > P.d: the aplication for mac computer has a window.open() but  
> > problem is the windows browsers, so instead of that
> > I've been trying to apporach the windows, not much of success right  
> > now.
> >
> >
> > On Feb 2, 2009, at 1:13 PM, jim.abbott45 wrote:
> >
> >> Gustavo:
> >>
> >> Sorry, but I don't think the approach you are taking is necessarily
> >> advisable, or even technically correct (in one regard). Specifically:
> >>
> >> 1) screen.width (and screen.height, and screen.availableWidth, etc.)
> >> allow JavaScript (DOM) code to discover the size of the user's  
> >> monitor
> >> (screen hardware), not of the browser window in which your Flex
> >> application is running. (The available* properties then subtract from
> >> that size any operating system 'reserved' screen real estate, such as
> >> the Windows task bar.)
> >>
> >> 2) I would be very surprised if JavaScript code could alter the value
> >> of any of these properties--by definition they could not be under the
> >> control of a browser window, so they should be read-only. Therefore,
> >> code like
> >>
> >> screen.width = 1024;
> >>
> >> should not be expected to work.
> >> Even if that code _does_ happen to work with one Browser or Operating
> >> System, I wouldn't rely on it!
> >>
> >> 3) A reasonably reliable way to ensure that your application is
> >> running in a browser window of the size that you want, is to use the
> >> JavaScript/browser DOM Window.open() method to open a new window,
> >> which gives you the opportunity to specify the size of browser window
> >> that you want your application to have. Be sure to note that you are
> >> specifying the overall (e.g., outer) size of the window; you are NOT
> >> specifying how much (client) area that your application will get. ***
> >> Different brands (and versions) of browsers will use different  
> >> amounts
> >> of space for their own 'chrome' (UI elements such as the URL/address
> >> bar, etc.). I don't know of any way other than cross-browser testing
> >> to discover the exact values, and they may change when a new version
> >> of a browser is released!
> >>
> >> 4) If you don't want to open a new browser window, then you can use
> >> the Window.resizeTo() DOM call in order to modify the size of the
> >> current window.
> >>
> >> For both 3) and 4), security policy in modern browsers may affect:  
> >> the
> >> success of opening a new window (i.e., pop-up blockers), and to place
> >> limits on net window size.
> >>
> >> 5) You can call the JavaScript/DOM code from your Flex application
> >> using the Flash ExternalInterface API. For more information, see (for
> >> example):
> >> http://livedocs.adobe.com/flex/3/html/help.html? 
> >> content=passingarguments_4.html
> >>
> >> 6) For more information about the Window.resizeTo() browser DOM API,
> >> see (for example):
> >> http://msdn.microsoft.com/en-us/library/ms536723(VS.85).aspx
> >>
> >> 7) My _recommendation_ is that you consider abandoning the notion  
> >> of a
> >> fixed-size application window. Flex containers support liquid layout
> >> very nicely and it is not much (extra) work to let your application
> >> work that way. In other words, if/when the user resizes their browser
> >> window, have your application adjust its layout accordingly. If  
> >> you do
> >> that, I think that it is also reasonable to specify a (window) size
> >> below which your application won't be able to re-size itself to (and,
> >> thus, scroll bars may appear).
> >>
> >> Good luck!
> >> --Jim
> >>
> >> --- In flexcoders@yahoogroups.com, Gustavo Duenas LRS  
> >> <gduenas@> wrote:
> >> >
> >> > do you know where I can get examples of this ExternalInterface?
> >> >
> >> > Regards,
> >> >
> >> > Gustavo
> >> >
> >> > On Feb 2, 2009, at 10:45 AM, Tracy Spratt wrote:
> >> >
> >> > >
> >> > > If that works in javascript, in different browsers, then you can
> >> > > get those values through ExternalInterface
> >> > >
> >> > >
> >> > >
> >> > > Tracy Spratt
> >> > > Lariat Services
> >> > >
> >> > > Flex development bandwidth available
> >> > >
> >> > > From: flexcoders@yahoogroups.com
> >> > > [mailto:flexcod...@yahoogroups.com] On Behalf Of Gustavo  
> >> Duenas LRS
> >> > > Sent: Monday, February 02, 2009 9:33 AM
> >> > > To: flexcoders@yahoogroups.com
> >> > > Subject: [flexcoders] sizing dinamically the screen
> >> > >
> >> > >
> >> > >
> >> > > Ok, Coders, this is my problem I have set the width and height  
> >> of my
> >> > > application to 1024 to 768 , it works on mac, but in pc you  
> >> know what
> >> > > would happen with the IE7...
> >> > > well I just think this, just addind a creationComplete code  
> >> like....
> >> > >
> >> > > function initSize(){
> >> > >
> >> > > screen.width= screen.availWidth;
> >> > > screen.height= screen/availHeight;
> >> > >
> >> > > this think works in Javascript there is counterpart on flex or it
> >> > > works on flex?
> >> > >
> >> > > I'd appreciate your help.
> >> > >
> >> > > Gus
> >> > >
> >> > >
> >> > >
> >> > >
> >> >
> >>
> >>
> >
> >
> >
>


Reply via email to