How to acess one mxml component id in another mxml component?

8 views
Skip to first unread message

dilu

unread,
Nov 6, 2009, 7:16:27 AM11/6/09
to Flex India Community
Hi ,
I want to access one mxml componet id to another mxml component .
I have one mxml component(ABCD) where there is a Vbox whose id is
vbox1.
I want to access this vbox1 to another mxml component (DEFG).
To access this I am doing something like this:
1.On the main mxml application I have declared one variable :-
public var abcd:ABCD=new ABCD();
2.On the DEFG mxml component I am trying to access vbox1 like this:
Application.application.abcd.vbox1.
But its throwing error "Cannot access a property or method of a null
object reference."
Do any of you is having any idea how to deal with this ?
Regards
Dileep

Sampath

unread,
Nov 6, 2009, 9:37:29 AM11/6/09
to flex_...@googlegroups.com
Hi,

Try this

public var abcd:ABCD=new ABCD();

addChild(abcd);

Regards
Sampath

--------------------------------------------------
From: "dilu" <discover...@gmail.com>
Sent: Friday, November 06, 2009 5:46 PM
To: "Flex India Community" <flex_...@googlegroups.com>
Subject: [flex_india:26463] How to acess one mxml component id in another
mxml component?

dileep singh

unread,
Nov 7, 2009, 2:19:36 AM11/7/09
to flex_...@googlegroups.com
Sampath,
Before adding I want to access it through Application.application....
But I am not able to access it..

tahir alvi

unread,
Nov 7, 2009, 8:57:27 AM11/7/09
to flex_...@googlegroups.com
You need to access the component or componenet methods?
 
Please clear to me.
 
Thanks.

 

Abhinav Mehta

unread,
Nov 7, 2009, 11:33:25 PM11/7/09
to flex_...@googlegroups.com
try for
mx.core.Application.application.<class name>...and so on.
 
Regards
Abhinav Mehta
MSRIT- Bangalore

dileep singh

unread,
Nov 9, 2009, 12:05:32 AM11/9/09
to flex_...@googlegroups.com
I need to access one vbox which is inside one component.

Manikandan

unread,
Nov 9, 2009, 2:11:19 AM11/9/09
to Flex India Community
Dear Dillu,

VBox is not created you have accessing time.

So please check the VBox is created or Not?

I have suggest, you don't use Application.application

If you have remove one Component this is very dangerous. So try to
write Custom Event access to the component.

Thanks with Regards,
Manikandan M S
Exuvis

jakir qureshi

unread,
Nov 9, 2009, 2:00:43 AM11/9/09
to flex_...@googlegroups.com
Hi,

you can add child the vbox into your component .

Regards,

Jakir
--
Thanks & Regards

M.Jakir Qureshi

flexorz group of flex corders

unread,
Nov 9, 2009, 5:47:37 AM11/9/09
to flex_...@googlegroups.com
or you can pass a reference/function on the component which you want to access in to the component you are going trigger it.
this way those are not hard binded.

yes application.application reference is not recommended.

cheers
dinukx

dileep singh

unread,
Nov 10, 2009, 6:52:15 AM11/10/09
to flex_...@googlegroups.com
Can anyone tell me straightforward with some piece of code.I am newbie to flex.Please have a look on my code what I have pasted.According to that give me some piece of code.
Reply all
Reply to author
Forward
0 new messages