Re: [flexcoders] Re: sizing dinamically the screen
Hey See the easiest thing is to replace the x and y with 100% values say for eg now ur app width is 1024 enter 100% On Tue, Feb 10, 2009 at 8:55 AM, Amy amyblankens...@bellsouth.net wrote: --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Gustavo Duenas LRS gdue...@... wrote: thanks Amy, but it seems when I try to tell the document in Js about the new size, that it is not doing the resize, Example is trying to do the sizing in the document for vista and others like document.width = screen.availWidth; document.height= screen.availHeight; those arguments work in theory but it seems they are not working in Vista or XP... I don't what else to do, actually I have an odd error in the application: TypeError: Error #1009: Cannot access a property or method of a null object reference. at lrsAd/resizerFlash() at lrsAd/___Application1_creationComplete() at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.core::UIComponent/dispatchEvent() at mx.core::UIComponent/set initialized() at mx.managers::LayoutManager/doPhasedInstantiation() at Function/http://adobe.com/AS3/2006/builtin::apply() at mx.core::UIComponent/callLaterDispatcher2() at mx.core::UIComponent/callLaterDispatcher() this is the flash windows that appears now in my browser. //code for the application: creationComplete=resizerFlash() here is the code in the flex: //importamos los datos para el external interface// import flash.external.ExternalInterface; //funcion para usar la external interface// public function resizerFlash():void{ var h:int; var w:int if (ExternalInterface.available){ h= ExternalInterface.call( movieHeight); root.stage.height = h; w=ExternalInterface.call( movieWidth); root.stage.width = w; trace(h); trace(w); } } Set your Application width and height to 100%. Then, when javaScript resizes the Object and/or Embed tag (NOT the document), then the Application will resize itself appropriately. You may want to do some basic experimentation and/or research on DHTML. That's beyond the scope of this forum.
Re: [flexcoders] Re: sizing dinamically the screen
thanks Amy, but it seems when I try to tell the document in Js about the new size, that it is not doing the resize, Example is trying to do the sizing in the document for vista and others like document.width = screen.availWidth; document.height= screen.availHeight; those arguments work in theory but it seems they are not working in Vista or XP... I don't what else to do, actually I have an odd error in the application: TypeError: Error #1009: Cannot access a property or method of a null object reference. at lrsAd/resizerFlash() at lrsAd/___Application1_creationComplete() at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.core::UIComponent/dispatchEvent() at mx.core::UIComponent/set initialized() at mx.managers::LayoutManager/doPhasedInstantiation() at Function/http://adobe.com/AS3/2006/builtin::apply() at mx.core::UIComponent/callLaterDispatcher2() at mx.core::UIComponent/callLaterDispatcher() this is the flash windows that appears now in my browser. //code for the application: creationComplete=resizerFlash() here is the code in the flex: //importamos los datos para el external interface// import flash.external.ExternalInterface; //funcion para usar la external interface// public function resizerFlash():void{ var h:int; var w:int if (ExternalInterface.available){ h= ExternalInterface.call( movieHeight); root.stage.height = h; w=ExternalInterface.call( movieWidth); root.stage.width = w; trace(h); trace(w); } } what that means, I'm afraid my understanding is not that good. Gustavo On Feb 2, 2009, at 10:06 PM, Amy wrote: --- In flexcoders@yahoogroups.com, Gustavo Duenas LRS gdue...@... wrote: actually I'm trying to pass the JS var with the availWidth to flex in order to be used on var h:number = ExternalInterface.call(getAvailWidth); var w:humber = ExternalInterface.call(getAvailHeight); root.stage.width = w root.stage.height=h assuming I have in the html wrapper function getAvailWidth{ and so on} This is exactly what I'm trying to accomplish. You need to be resizing the object/embed tag, not telling Flex to resize the Application object, so Flex doesn't need to be involved in the process, unless you want to be able to click a button to initiate the resize. But all that needs to do is just call a js function, which should be able to handle it without any info from Flex.
RE: [flexcoders] Re: sizing dinamically the screen
Reduce the variables, establish functionality one step at a time, testing to make sure it continues to work. Step 1: Write javascript to resize what you want. Don't do anything else until you can do this part. ... 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 09, 2009 1:24 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Re: sizing dinamically the screen thanks Amy, but it seems when I try to tell the document in Js about the new size, that it is not doing the resize, Example is trying to do the sizing in the document for vista and others like document.width = screen.availWidth; document.height= screen.availHeight; those arguments work in theory but it seems they are not working in Vista or XP... I don't what else to do, actually I have an odd error in the application: TypeError: Error #1009: Cannot access a property or method of a null object reference. at lrsAd/resizerFlash() at lrsAd/___Application1_creationComplete() at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.core::UIComponent/dispatchEvent() at mx.core::UIComponent/set initialized() at mx.managers::LayoutManager/doPhasedInstantiation() at Function/http://adobe.com/AS3/2006/builtin::apply( http://adobe.com/AS3/2006/builtin::apply( ) at mx.core::UIComponent/callLaterDispatcher2() at mx.core::UIComponent/callLaterDispatcher() this is the flash windows that appears now in my browser. //code for the application: creationComplete=resizerFlash() here is the code in the flex: //importamos los datos para el external interface// import flash.external.ExternalInterface; //funcion para usar la external interface// public function resizerFlash():void{ var h:int; var w:int if (ExternalInterface.available){ h= ExternalInterface.call( movieHeight); root.stage.height = h; w=ExternalInterface.call( movieWidth); root.stage.width = w; trace(h); trace(w); } } what that means, I'm afraid my understanding is not that good. Gustavo On Feb 2, 2009, at 10:06 PM, Amy wrote: --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , Gustavo Duenas LRS gdue...@... wrote: actually I'm trying to pass the JS var with the availWidth to flex in order to be used on var h:number = ExternalInterface.call(getAvailWidth); var w:humber = ExternalInterface.call(getAvailHeight); root.stage.width = w root.stage.height=h assuming I have in the html wrapper function getAvailWidth{ and so on} This is exactly what I'm trying to accomplish. You need to be resizing the object/embed tag, not telling Flex to resize the Application object, so Flex doesn't need to be involved in the process, unless you want to be able to click a button to initiate the resize. But all that needs to do is just call a js function, which should be able to handle it without any info from Flex.
[flexcoders] Re: sizing dinamically the screen
--- In flexcoders@yahoogroups.com, Gustavo Duenas LRS gdue...@... wrote: thanks Amy, but it seems when I try to tell the document in Js about the new size, that it is not doing the resize, Example is trying to do the sizing in the document for vista and others like document.width = screen.availWidth; document.height= screen.availHeight; those arguments work in theory but it seems they are not working in Vista or XP... I don't what else to do, actually I have an odd error in the application: TypeError: Error #1009: Cannot access a property or method of a null object reference. at lrsAd/resizerFlash() at lrsAd/___Application1_creationComplete() at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.core::UIComponent/dispatchEvent() at mx.core::UIComponent/set initialized() at mx.managers::LayoutManager/doPhasedInstantiation() at Function/http://adobe.com/AS3/2006/builtin::apply() at mx.core::UIComponent/callLaterDispatcher2() at mx.core::UIComponent/callLaterDispatcher() this is the flash windows that appears now in my browser. //code for the application: creationComplete=resizerFlash() here is the code in the flex: //importamos los datos para el external interface// import flash.external.ExternalInterface; //funcion para usar la external interface// public function resizerFlash():void{ var h:int; var w:int if (ExternalInterface.available){ h= ExternalInterface.call( movieHeight); root.stage.height = h; w=ExternalInterface.call( movieWidth); root.stage.width = w; trace(h); trace(w); } } Set your Application width and height to 100%. Then, when javaScript resizes the Object and/or Embed tag (NOT the document), then the Application will resize itself appropriately. You may want to do some basic experimentation and/or research on DHTML. That's beyond the scope of this forum.
[flexcoders] Re: sizing dinamically the screen
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 gdue...@... 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
Re: [flexcoders] Re: sizing dinamically the screen
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 gdue...@... 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
Re: [flexcoders] Re: sizing dinamically the screen
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 gdue...@... 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
[flexcoders] Re: sizing dinamically the screen
Gustavo: Your page _does_ render on IE (7) on Windows (XP). However, it does *not* appear to be re-sizing when the (Browser) window is re-sized. FYI: at 800 x 600 window size, I can see down to the line your target group... and ending at ...Right Solutions has t At 1024 x 768, all the text is seen, but the background image is clipped at about the lower right (visible) corner of the bridge. At 1280 x 1024, all of the content is seen _except_ the outer-most areas of the blue semi-circles on the far left and right. Regards, Jim --- In flexcoders@yahoogroups.com, Gustavo Duenas LRS gdue...@... 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
[flexcoders] Re: sizing dinamically the screen
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):
Re: [flexcoders] Re: sizing dinamically the screen
actually I'm trying to pass the JS var with the availWidth to flex in order to be used on var h:number = ExternalInterface.call(getAvailWidth); var w:humber = ExternalInterface.call(getAvailHeight); root.stage.width = w root.stage.height=h assuming I have in the html wrapper function getAvailWidth{ and so on} This is exactly what I'm trying to accomplish. Gus On Feb 2, 2009, at 6:08 PM, jim.abbott45 wrote: 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
[flexcoders] Re: sizing dinamically the screen
--- In flexcoders@yahoogroups.com, Gustavo Duenas LRS gdue...@... wrote: actually I'm trying to pass the JS var with the availWidth to flex in order to be used on var h:number = ExternalInterface.call(getAvailWidth); var w:humber = ExternalInterface.call(getAvailHeight); root.stage.width = w root.stage.height=h assuming I have in the html wrapper function getAvailWidth{ and so on} This is exactly what I'm trying to accomplish. You need to be resizing the object/embed tag, not telling Flex to resize the Application object, so Flex doesn't need to be involved in the process, unless you want to be able to click a button to initiate the resize. But all that needs to do is just call a js function, which should be able to handle it without any info from Flex.