Public Voice Network
- blog 3121131211
- CS4 Question 66
- Got a blind date tonight… 2020
- EC: Shoe at Rush Hour 55
- FMT 120508 2626
- flash question 77
- design works vs. carl dek… 44
- Quick Survey for Philosop… 2020
- Trapped in Elevator 99
- Official 2008-09 NHL Thre… 112112
- you must know! 55
- Pic of the Day 1049510495
- rippity rip 5959
- QBN Mugs '08 475475
- Politics 50605060
- piece 1010
- Typeface 77
- Copy Font 77
- Simple, classy, handwritt… 1414
- You Suck... 22
- QBN Drinks - Birmingham 1212
- Eurobest 2008 11
- New YouTube player 1212
- Running text. 1010
Flex 3 problem 44 Responses
Last post: 3 months ago | Thread started: Sep 5, 08, 4:01 a.m.
- rounce
Dear QBN...
/// THE OBJECTIVE ///////////////
The application first loads and displays a PortfolioBar instance. The user clicks the a button and the application state is changed and the inital PortfolioBar is removed and another instance (which requests data, in XML format, from another table in the database) is displayed. In a nutshell, it works...
________________________________…
/// THE PROBLEM /////////////////
The first time the first instance is removed from the stage and the second one is being created I get a null object reference error when I try to access any property of the MXML created display objects. I click continue in the Flex debugger and change the application state then switch back to the problematic state and then it works.Yes I have tried
accessing other Display Objects before the scrubber and it's the same error every time./* KERRRRRAAAAZY SHIT HUH? */
________________________
/// ERROR OUTPUT ////////////////
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at sharpedge.components.ui::Portfol… Work\Sharpedge\src\sharpedge\com…
at sharpedge.components.ui::Portfol… Work\Sharpedge\src\sharpedge\com…
at flash.display::DisplayObjectCont…
at mx.core::UIComponent/http://www…
at mx.core::Container/addChildAt()
at mx.core::Container/addChild()
at mx.states::AddChild/apply()
at mx.core::UIComponent/applyState…
at mx.core::UIComponent/commitCurre…
at mx.core::UIComponent/setCurrentS…
at mx.core::UIComponent/set currentState()
at lib::Genlib$/switchState()[C:\Cl… Work\Sharpedge\src\lib\Genlib.as…
at sharpedge.components.ui::MainMen… Work\Sharpedge\src\sharpedge\com…
_____________________
/// THE CODE ////////////////////
states: http://pastebin.com/m2bfe2101
PortfolioBar.mxml: http://pastebin.com/mb4209f3
_____________________- Sep 5, 08, 4:01 a.m. – Permalink
- maximillion_
im not an mxml guy (im straight class based AS) but is the second instance trying to use a referenece to the stage befgore being added to stage. try adding a listener Event.ADDED_TO_STAGE listener to the object and thencalling the code in init(); (you might need to make a new method for that - is init() the constructor in mxml?)


- Dog-earSep 5, 08, 4:13 a.m. – Permalink
- maximillion_
something like this :http://pastebin.com/m509e3b5a


- Dog-earSep 5, 08, 4:18 a.m. – Permalink
- rounce
Sorry I pasted an older error by accident here's the propper one, sorry about that:
http://pastebin.com/m37f860bdThe init(); method is the event handler that is called when the component is added to the stage (see line 3 : col 61) and serves as an 'entry point' of sorts for the component logic (setting vars, event listeners n shit).
Thanks max for not TL;DR'ing this.


- Dog-earSep 5, 08, 4:37 a.m. – Permalink


