Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8346745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:07:07+00:00 2026-06-09T07:07:07+00:00

I keep getting a ‘null’ for the instance of the application under flash media

  • 0

I keep getting a ‘null’ for the instance of the application under flash media server. I can’t seem to pass the value from one function to another function

XML Sample

<bsettings>
<obj title="instance">19046</owner>
<obj title="id">uniqueid</owner>
<obj title="name">somename</owner>
<obj title="date">08/01/2012</owner>
<obj title="gender">female</owner>
</bsettings>

AS3 Code

<mx:Application 
    xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
    applicationComplete="initConnection(event)">

private var xinstance:String;
private var xmlstring:String = "http://www.blah.com/blahblah.xml";

protected function getXML():void{
XML.ignoreWhitespace = true;
var myXML:XML;
var myLoader:URLLoader=new URLLoader();
myLoader.load(new URLRequest(xmlstring));
myLoader.addEventListener(Event.COMPLETE, processXML);

function processXML(e:Event):void {
myXML = new XML(e.target.data);
for (var i:int = 0; i<myXML.*.length(); i++){
xinstance = myXML.obj[0];
xblah = myXML.obj[1];
xblah1 = myXML.obj[2];
xblah2 = myXML.obj[3];
xblah3 = myXML.obj[4];
}
}
}

private function initConnection(event:FlexEvent):void{
getXML();

//problem here, the xinstance isn't saved in the fmsstring
var fmsstring:String = "rtmp://blah.com/appname/" + xinstance;

nc = new NetConnection();
nc.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
nc.connect(fmsstring);
nc.client = this;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T07:07:08+00:00Added an answer on June 9, 2026 at 7:07 am

    Your problem is you’re not waiting for the XML to load before using the xinstance string. On the initConnection function you call getXML() – which starts to load the xml, you need to wait until the xml is loaded before doing the rest of the code in the initConnection function. Here is a suggested change: (I added the go() function which is called AFTER the xml is processed)

    private var xinstance:String;
    
    protected function getXML():void {
        var xmlstring:String = "http://www.blah.com/blahblah.xml";
        XML.ignoreWhitespace = true;
        var myLoader:URLLoader=new URLLoader();
        myLoader.load(new URLRequest(xmlstring));
        myLoader.addEventListener(Event.COMPLETE, processXML);
    }
    
    protected function processXML(e:Event):void {
        var myXML:XML = XML(e.target.data)
    
        //THIS IS NOT A GOOD WAY TO DO THIS, use e4x
        //for (var i:int = 0; i<myXML.*.length(); i++){
        //xinstance = myXML.obj[0];
        //xblah = myXML.obj[1];
        //xblah1 = myXML.obj[2];
        //xblah2 = myXML.obj[3];
        //xblah3 = myXML.obj[4];
        //}
    
        //MUCH cleaner/easier/more efficient
        xinstance = myXML.bsettings.obj.(@title == "instance");
    
        go();
    }
    
    private function initConnection(event:FlexEvent):void{
        getXML();
    }
    
    private function go():void {
        var fmsstring:String = "rtmp://blah.com/appname/" + xinstance;
    
        nc = new NetConnection();
        nc.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
        nc.connect(fmsstring);
        nc.client = this;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I keep getting this NPE in my application and I can't seem to get
I keep getting an error saying that @android:style/Widget.Holo.Light.Button.Borderless is not public and so can't
I keep getting this error with my Play 2.0 application: play.core.ActionInvoker$$anonfun$receive$1$$anon$1: Execution exception [[MatchError:
I keep getting the following error: * #1005 - Can't create table 'classorganizer.turma' (errno:
I keep getting an error: invaled syntax for 1.add_xpath('tagLine', '//p[@class=tagline]/text()') and I cannot seem
I keep getting a 500 Internal Server Error when using the following Rewrite rule
I keep getting an error saying my value is not positioned on a valid
I keep getting bad pointers. Can anyone tell me what am I doing wrong?
I keep getting this error Object reference not set to an instance of an
I keep getting tasks that are above my skill level. How can I address this without coming accross as grossly incompetent?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.