Resizing a flex application

I am trying to write a resize function for my flex
application. I have pasted a simple sample below, but when I try to
run this application I get the following error:
TypeError: Error #1009: Cannot access a property or method of
a null object reference.
This is my application:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="absolute" resize="resizeHandler()">
<mx:Script>
<![CDATA[
private function resizeHandler():void {
t.text = stage.width + " - " + stage.height;
t.text += "\n" + stage.stageWidth + " - " +
stage.stageHeight;
]]>
</mx:Script>
<mx:Panel x="10" y="10" width="250" height="200"
layout="absolute">
<mx:TextArea id="t" x="0" y="0" text="test"/>
</mx:Panel>
</mx:Application>
Can someone tell me where I am going wrong?
Thanks in advance

DIsplay Object Stage would cause the exception the first time
you run the application. A simple if condition can help you
overcome the issue..
private function resizeHandler():void {
if(stage != null){
t.text = stage.width + " - " + stage.height;
t.text += "\n" + stage.stageWidth + " - " +
stage.stageHeight;
}

Similar Messages

  • Trying to make a flex application scalable in its display size by using a "Host-swf" - Problem

    We created a flex application using Flex 3. What we are
    trying to do is to make this application scalable in its display
    size. That means we want the application to scale itself to exactly
    fit the size of the browser window without using a scrollbar like
    normal Flash-swfs do. Sadly flex application don't scale like a
    normal flash swf.
    To get a workaround for this we created a so called
    "Host-swf" with flash CS3. This Host-swf loads the flex application
    and adds it as a child. And voila: When calling the Host-swf our
    application can scale.
    We used this code to achive this:
    var oUrlRequest:URLRequest = new
    URLRequest("Flex-Application.swf");
    var oURLLoader:Loader = new Loader();
    oURLLoader.load(oUrlRequest);
    addChild(oURLLoader);
    This works perfectly as long the browser window is larger
    then the resolution of the host-swf (900*600) when calling the url
    for the application:
    Picture showing the
    scaling
    But it doesnt't work out when the browser window is smaller
    than 900*600. The application is then shown with a scrollbar, and
    when resizing the browser window the scrollbar is still there:
    Picture showing the
    application with scrollbar
    Maybe anyone already tried to achive the same thing and has a
    different solution for us?
    Thank you in advance!

    "noby_95" <[email protected]> wrote in
    message
    news:gpsue6$rhh$[email protected]..
    > We created a flex application using Flex 3. What we are
    trying to do is to
    > make
    > this application scalable in its display size. That
    means we want the
    > application to scale itself to exactly fit the size of
    the browser window
    > without using a scrollbar like normal Flash-swfs do.
    Sadly flex
    > application
    > don't scale like a normal flash swf.
    >
    > To get a workaround for this we created a so called
    "Host-swf" with flash
    > CS3.
    > This Host-swf loads the flex application and adds it as
    a child. And
    > voila:
    > When calling the Host-swf our application can scale.
    >
    > We used this code to achive this:
    >
    >
    > --------------------------
    > var oUrlRequest:URLRequest = new
    URLRequest("Flex-Application.swf");
    > var oURLLoader:Loader = new Loader();
    > oURLLoader.load(oUrlRequest);
    > addChild(oURLLoader);
    >
    >
    > -------------------------
    >
    > This works perfectly as long the browser window is
    larger then the
    > resolution
    > of the host-swf (900*600) when calling the url for the
    application:
    >
    http://www.gansl-online.de/Bild1.jpg
    >
    > But it doesnt't work out when the browser window is
    smaller than 900*600.
    > The
    > application is then shown with a scrollbar, and when
    resizing the browser
    > window the scrollbar is still there:
    >
    http://www.gansl-online.de/Bild2.jpg
    >
    > Maybe anyone already tried to achive the same thing and
    has a different
    > solution for us?
    When I set the Application width and height to a percentage
    number, it will
    change its size based on the size of the window.

  • Can I embed the Flash Document preview on my Flex Application

    Hi I am creating a Flex application utilizing acrobat document sharing, and I was wondering if I could have it display a preview of my documents very similar to http://share.acrobat.com/adc/.
    I notice that you can embed flash on webpage by the use of this viewer https://share.acrobat.com/adc/flex/mpt.swf, and I tried loading it and appending necessary variables to it, it works but I cannot resize the viewer. I'm not sure if Im doing it wrong or its just the viewer not compatible at all.
    Thanks, I really appreciate if anyone could point me on the right direction.

    I'm sorry, but at present this isn't something that we support. We didn't build the viewer with the intent of allowing others to use it in flex.
    Best Regards,
    Michelle

  • How can I set auto-resize for an application?

    Hi, I have created a flex application but now I have a problem: if I use it on a netbook, with little display, or I use it throught facebook the application does not auto-resize nor vertical/horizontal bar appear!
    Is there a way to let application auto-resize?I used flash builder 4 with a graphite-spark theme and no layout at all...help me please!

    Yes, but the problem are x and y : they are absolute so containers will eventually collide...you mean the only way is to use nested containers and not use coordinates in order to put elements on the application?

  • Flex application running under AIR takes a long, long time to start.

    I have a flex application which runs on a desktop under AIR. The application has an assets folder with 3,500 mp3 soundclips totalling about 50MB. The problem is, the application takes around 90 seconds to load. I'm sure that AIR is scanning the application folder and doing something with the contents because if I delete the assets folder it loads in about 5 seconds. Does anyone know why AIR/Flex would do this, and why it doesn't exhibit the same problem if I run or debug in Flexbuilder on eclipse? It's making my killer app unusable!
    Thanks
    Paulo

    Well, I've spent a bit longer looking at this now, and the problem appears to lie with my encrypted local store. The first thing that happens is for the app to read the product key from the ELS. But, it fails (for some unknown reason). So, the app seems to hang there for 90 seconds until it eventually renders the welcome screen. If I remove the assets folder it still fails to read from the ELS, but only takes a couple of seconds to start the welcome screen. This is where the scanning of the application folder seems to come into play, because if I remove the code which reads from the ELS the app starts within 2 seconds whether the asset folder is there or not.
    I think the slow startup and the scanning of the assets folder are just symptoms of a different problem, i.e. a problem with the ELS. I don't have the same problem with my development environment though - it's only when I test deploy the application.
    Thanks for your help on this problem EgorKDie. I think I should be able to resolve it once I can sort out why the ELS is being awkward.

  • How to show double byte data in a Flex application

    Hi
    I am looking for a way to show UTF-8 formatted data in a Flex
    application. I have a Java app in the backend that generates an xml
    file. Some attributes in the file are encoded in UTF-8 (when data
    is Japanese or Chinese...). My Flex app is showing box characters.
    I have XSLT app that generates html based off this xml file. The
    browser i showing the Japanese characters fine.
    I am wondering what the trick is to get Flex app show this
    data.
    Thanks
    Videoguy

    It turned out to be my XP that didn't have the the right lang
    sets installed. I have two PCs. On one everything showed up fine. I
    was able to view arabic, chinese data from xml just fine. On the
    other one, same swf didn't show them. There is MS knowledgebase
    article on how to enable east asian languages etc. I didn't give it
    a try. I am using other pc for my dev now.

  • What to look for in a web hosting company for Flex applications

    Hello,
    I am trying to figure out what I need to look for in a web
    hosting company if I want to deploy my own Flex applications? I
    don't anticipate having any special requirements other than the
    ability to interact with databases and XML files. Can someone help
    me figure out what the server-side requirements are?
    Thanks in advance!
    Matt

    then almost 99.9% hosting will work.
    if you want a Flexx app with compiler then oo thats different
    but as you say "I don't anticipate having any special requirements
    other than the ability to interact with databases and XML files"
    then you can go with pretty much any hosting, as long as they have
    apache, Database serve and I think thats it.

  • How to Call a AIR application from Flex Application

    Hi,
        I have Used AIR (Desktop application) in Flex Builder to Upload a File from a local path and save it it a server path.
    I need to Call this AIR(Desktop application) from my Flex Application.... i.e
    I am using a link button to send a event using Script and Forward that Desktop application  from Flex Screen
    But it doesnot load that (Desktop application)  in Screen. Only Balnk screen is loaded from path
    Here is the code
    AIR(Desktop application)
    <?xml version="1.0" encoding="utf-8"?><mx:WindowedApplication 
    xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="openBrowseWindow();">
    <mx:HTTPService id="urlpath" showBusyCursor="true" useProxy="false" method="
    POST" url="http://localhost:8080/nat/FlexAction.do?method=UrlPath"result="pathresult(event)"
    fault="faultHandler(event)"
    >  
    </mx:HTTPService> 
    <mx:Script>
    <![CDATA[
    import mx.events.FileEvent; 
    import mx.rpc.events.ResultEvent; 
    import mx.rpc.events.FaultEvent; 
    import mx.utils.ObjectUtil;  
    import mx.controls.Alert;
    private  
    var openFile:File = new File() 
    private  
    function openBrowseWindow():void{openFile.addEventListener(Event.SELECT, onOpenFileComplete);
    openFile.addEventListener(Event.OPEN, load);
    openFile.browse();
    private  
    function load():void{Alert.show(
    "load"); 
    var imageTypes:FileFilter = new FileFilter("Images (*.jpg, *.jpeg, *.gif, *.png)", "*.jpg; *.jpeg; *.gif; *.png"); 
    //var textTypes:FileFilter = new FileFilter("Text Files (*.txt, *.rtf)", "*.txt; *.rtf"); 
    var allTypes:Array = new Array(imageTypes);openFile.browse(allTypes);
    private  
    function faultHandler(event:FaultEvent):void { 
    //Alert.show("Fault")Alert.show(ObjectUtil.toString(event.fault));
     private  
    function pathresult(event:ResultEvent):void{Alert.show(
    "res") 
    //Alert.show(ObjectUtil.toString(event.result));}private  
    function onOpenFileComplete(event:Event):void{ 
    //mx.controls.Alert.show("event: "+event.target.nativePath +"UR!!!"); 
    var pPath = event.target.nativePath; 
    var parameters:Object = {FlexActionType:"PATH",path:pPath};  
    // Alert.show("Image Selected from Path : "+pPath); urlpath.send(parameters);
    //Alert.show("Passed.."+parameters);}
    ]]>
    </mx:Script>
    <mx:Button click="openBrowseWindow();onOpenFileComplete(event)" name="Upload" label="Upload" x="120.5" y="10"/> 
    Here is Mxml Code for Flex Application
    <?xml version="1.0" encoding="utf-8"?><mx:Application 
    xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns="http://ns.adobe.com/air/application/1.0.M4" >
    <mx:Script>
    <![CDATA[
    import mx.controls.Alert; 
    private function Upload():void{ 
    // CursorManager.setBusyCursor();  
    //var url:String = "HomeAction.do?method=onLoad"; 
    //var url:String = "assets/Air.swf"; 
    var url1:URLRequest = new URLRequest("assets/Air.swf");navigateToURL(url1,
    "_self"); 
    // CursorManager.removeBusyCursor(); }
    ]]>
    </mx:Script>
    <mx:LinkButton id="up" click="Upload()" x="295" y="215" label="UpLoad"/>
    In this code i forward using s url to Open tat  Desktop application but a blank screen appears with out the proper output...
    Please Help me in this to forward AIR from Flex Screen..
    Thanks in Advance
    With Regards
    Gopinath.A
    Software Developer
    First Internet Systems Pvt. Ltd.,
    Chennai

    try this
    http://www.leonardofranca.com/index.php/2009/09/17/launching-an-installed-air-application- from-the-browser/
    regards
    Leonardo França
    Adobe Certified Expert Flex 3 with AIR
    Adobe Certified Expert Rich Internet Application Specialist v1.0
    Adobe Certified Expert Flash CS3 Professional
    Certified Professional Adobe Flex 2 Developer
    Adobe Certified Professional Flash MX 2004 Developer
    http://www.leonardofranca.com
    http://twitter/leofederal
    Manager AUGDF - Adobe User Group do Distrito Federal
    http://www.augdf.com.br
    http://twitter/augdf

  • Hi All,i am currently working on a flex application that will allow the user to change the language

    Hi All,i am currently working on a flex application that will allow the user to change the language within the application from english to Japanese and vice versa. And everything works fine.
    I am using flex 4.5
    We allow the user to save records with english or japanese texts.
    problem
    When the user manually enters Japanese text and tries to save it the record defaults back to the default name (which is in english). But if you copy the entered text and paste it and then save it.It works fine.
    Any idea , why this is happening?
    Please let me know if the question is not clear.
    Looks like there was already a bug
    https://issues.apache.org/jira/browse/FLEX-28894?page=com.atlassian.jira.plugin.system.iss uetabpanels:all-tabpanel
    Not sure why does it say , Resolved .
    -KB
    Message was edited by: bKartik.b

    By Payal integration , you mean paypal button html ? or payment gateway setup etc ? If its a gateway configuration for your site domain then single page for all layout will work , but if you are using button code for all renditions then you would need to create separate pages for all.
    Thanks,
    Sanjit

  • Flex application not working when deployed run from Server

    Hi,
    I have Flex application which takes a parameter from user, makes a web-service call and returns the message.
    This application is running perfectly when I launch from IDE.
    But when I copy the files from bin-release to server and launch it, it gives me no result.
    In the crossdomain file on the server which hosts web-service, I have added the my host IP in the
    allow-access-from domain tag.
    In the initialization method of the application I load crossdomain using following code:
        Security.allowDomain("remoteservername");
        Security.loadPolicyFile("http://remoteservername/crossdomain.xml");
        var request:URLRequest = new URLRequest("http://remoteservername/crossdomain.xml");
        var loader:URLLoader = new URLLoader();
        loader.load(request);
    Is there a way I can debug application when running from server?
    Please give me some pointer to solve this problem.
    Thank you.
    Chintan

    Alex thanks for reply
    The URL for the app is http://<some_IP>/flex_app
    <some_IP> is added in crossdomain.
    Also we have outbound IP's and of these are also added in the crossdomain file.
    This is the current content of crossdomain file:
    <cross-domain-policy>
    <site-control permitted-cross-domain-policies="master-only"/>
    <allow-access-from domain="<some_IP>"/>
    <allow-access-from domain="<outbound_IP1>"/>
    <allow-access-from domain="<outbound_IP2>"/>
    <allow-access-from domain="<outbound_IP3>"/>
    <allow-http-request-headers-from domain="<outbound_IP1>" headers="SOAPAction"/>
    <allow-http-request-headers-from domain="<outbound_IP2>" headers="SOAPAction"/>
    <allow-http-request-headers-from domain="<outbound_IP3>" headers="SOAPAction"/>
    </cross-domain-policy>
    App runs perfectly fine when launched from Flex Builder.

  • Flex Application does not work outside of the default dir

    Hi,
    I have developed a flex application which calls a http
    service and displays the contents in a text area.
    This works fine when I execute it from the flex builder or
    from the directory where the flex builder stores it.
    If I copy the files to any other dir or the server, after
    making http call no result is displayed in the text area.
    Is there any thing else i need to do other building
    application in flex builder for deployment.
    Please help,
    Thanks in advance,
    Chintan

    "rtalton" <[email protected]> wrote in
    message
    news:gjlmvm$hrv$[email protected]..
    > Stubborn, aren't we? Ok, let me try again:
    > You only use "loadPolicyFile" to load a non-default
    policy file. remove
    > that
    > line from your code.
    > Also you do not need this line:
    > flash.system.Security.allowDomain("*");
    > ...in your code. Remove it. This is used when you have
    two SWFs on two
    > different servers. You do not.
    >
    > Again, read this page:
    >
    >
    http://livedocs.adobe.com/flex/3/html/help.html?content=deployingoverview_12.htm
    > l
    >
    > Your answer is there.
    > Hint: all you need is to *properly* deploy a
    cross-domain policy file.
    > Really.
    > I'm being very honest here. Have I ever lied to you
    before? No, I haven't.
    > So
    > you're buying the first round tonight after work, ok?
    Some people will do anything for a date ;-)

  • How to do single sign on for multiple webservices in flex application

    Hi Experts,
    I have created a flex application and using few webservices in that application. When I run the application its asking logon details for each and every webservice I used. However I want to do single sign On without providing logon details for each and every webservice.Please suggest me.
    Thanks and advance.

    Hi,
    if yout projects are deployed in their own Java EE context root then you have multiple applications, though logically you count them as one. Use OSSO or Oracle SSO (where OSSO should be fine since all deployments share the same instance)
    Frank

  • How to display pdf file in flex application

    hi,
    I am Ibran, I am using Flex4.5, in that i want to display a pdf file like images.
    How can i do it please anyone tell me.
    I have used navigateToURL(url),but this was going into navigation and i can't see my textfield and buttons.
    So without this  navigateToURL(url) how can i display a pdf file in flex without navigation so that i can see my textInputs and buttons.

    Flash does not have the ability to load/display/manipulate PDF files, so you can't open it directly in the flex application.  With clever HTML and javascript, you can make it appear that it is in the same window, but it will actually be in a separate window/div in the browser.  And yes, this has always seemed absurd to me that Adobe doesn't support PDF's......
    Mark

  • How to call setter Method of ActionScript class with in a Flex Application

    Hi
    I have Action class as shown :
    public class MyClass
    private var name:String 
    public function get name():String {
        return _initialCount;
    public function set name(name:String):void {
        name = name;
    Now please let me know how can i access this Action class under my Flex Application and call the setter Method of it to set the value for the name .
    For example on entering some data in a TextInput and  click of a submit Button , on to the Event Listener , i want to call the set name method of my ActionScript class .
    Please share your ideas on this .

    Thanks  Gordon for your resonse .
    Say for example my Action class is like this :
    public class MyClass
    private var name:String 
    public function get name():String {
        return name;
    public function set name(name:String):void {
        name = name;
    This is inside the MXML
    I know this way we can do it
    public var myclass:MyClass = new MyClass();
    myclass.name="Kiran";
    Now my query is can we do in this way also ??
    myclass.set name(SomeTextInput.text);
    Please share your views on this , waiting for your replies .
    Thanks in advance .

  • Is it possible to export of the stage of a Flex application in vector format?

    Is it possible to export of the stage of a Flex application in vector format?
    Right now our only option is to render our graphs to a (large, off-screen) bitmap and export that bitmap, which is a real shame because every
    component in Wondergraphs is 100% vector based.  Anyone at Adobe know more about this?

    Hi.
    Try start->search for pen and touch--> then uncheck "Use your finger as an input device" in the Touch tab.

Maybe you are looking for

  • Flash Builder 4 (Linux)

    Is there a planned Linux version of Flash Builder? I've been using the FB3 alpha release for a long time now, and I'm hoping that FB4 will be released for Linux. I'm sure there are many out there who are more than willing to pay for it. Flash Builder

  • Frame size doesn't match

    I'm working on an animated project...doing the animation in Flash and then doing various effects and editing in Premiere Pro CS3.  I've been rendering my scenes out of flash as PNG sequences, and then bringing them into Premiere...and so far it seems

  • Missing Account Name

    After shutting my computer down and restarting it about a half an hour later, my I realized my User name was no longer listed. It's as if it dissappered. I tried booting from the installtion CD in hopes i could maybe reset my password but the only ac

  • Keyboard lettering not correct.

    I have a brand new HP laptop with Window 7 and Intel core i5. When I type, all letters and numbers work but five. One of the keys, the one closest to the 'pause shift' when I push it, it enters the É instead of the interrogation point, so does the on

  • Programs on startup??

    First, I am running 10.5.8 (Snow Leopard is in the mail!!) on an almost brand new Mac Mini. Ok so i have this driver/program for a printer that starts on startup, and I would like it to not start on startup. I have tried to find the file/folder to de