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 7611413
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:39:47+00:00 2026-05-31T01:39:47+00:00

I am very new to actionscript3/flashbuilder and I’m trying to do something simple like

  • 0

I am very new to actionscript3/flashbuilder and I’m trying to do something simple like pass a value from one view to another view.

I worked out all my syntax errors, but I am still getting a NULL error

(TypeError: Error #1009: Cannot access a property or method of a null object reference)

…even though I have the values hard-coded in for testing.

I have 2 views, and when I press a button, it is supposed to pass a value to another view which then displays the passed value in a label.

Here are my 2 views:

view1:

<s:View xmlns:fx="http://ns.adobe.com/mxml/2009" 
    xmlns:s="library://ns.adobe.com/flex/spark" title="view1">
    <fx:Script>
        <![CDATA[
        var value1:int = 1;
        var value2:int = 2;
        ]]>
    </fx:Script>
    <s:Button id="btn1" x="5" y="10" width="25" label="Button 1" click="navigator.pushView(view2, {val:value1})"/>
    <s:Button id="btn2" x="15" y="100" width="25" label="Button 2" click="navigator.pushView(view2, {val:value2})"/>
</s:View>

view2:

 <s:View xmlns:fx="http://ns.adobe.com/mxml/2009" 
    xmlns:s="library://ns.adobe.com/flex/spark" title="view2">
<fx:Declarations>
    <!-- Place non-visual elements (e.g., services, value objects) here -->

</fx:Declarations>
<fx:Script>
    <![CDATA[
        var passedValue:int = data.val;
    ]]>
</fx:Script>
    <s:Label x="75" y="100" width="200" text="{passedValue}" />

Any help would be appreciated!

Thanks!

  • 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-05-31T01:39:48+00:00Added an answer on May 31, 2026 at 1:39 am

    Your problem is you’re trying to access the data object before the view is done being created.

    Add a creationComplete handler to your view:

    <s:View xmlns:fx="http://ns.adobe.com/mxml/2009" 
    xmlns:s="library://ns.adobe.com/flex/spark" title="view2" creatonComplete="init(event)">
    

    And inside your init method you will be able to access the data object

    <fx:Script>
    <![CDATA[
       [Bindable] private var passedValue:int;
        protected function init(e:FlexEvent):void{
            passedValue = data.val; 
       }
    ]]>
    </fx:Script>
    

    Also, notice I added [Bindable] to your passedValue var.
    This is because you’re tying to bind its value to your label. In order for that to work you need to use [Bindable] on your var

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Very new to Android and trying to install a Android project from an SVN
Very new to JQuery and MVC and webdevelopment over all. I'm now trying to
Warning - I am very new to NHibernate. I know this question seems simple
I am VERY new to ASP.NET. I come from a VB6 / ASP (classic)
Im very new to Adobe Flex/Actionscript and am trying to create a person search
I am very new to both JavaScript and ActionScript. I am trying to get
Very new to PHP/programming in general, and I've been trying to run a PHP
I am playing around with ActionScript 3 and trying to build a very simple
I am very new to ActionScript and Flash development so excuse any incorrect terminology
I'm very new to flash and actionscript 3. I've been reading a lot about

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.