I'm assuming that your main.mxml contains your <mx:Application> tag, so try
this:
package mycontrol.container-s
{
import mx.controls.-Alert;
import flash.display.-DisplayObject;
import flash.events.-Event;
import flash.events.-MouseEvent;
import flash.events.-TimerEvent;
import flash.utils.-Timer;
import mx.core.Application;
.
.
.
public function doSomething(-):void {
Application.application.imgNewMessage.-visible=false;
}
}
HTH,
Randy
_____
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of nocturnal_world
Sent: Friday, February 01, 2008 7:40 AM
To: [email protected]
Subject: [flexcoders] Referencing components from custom controls
Hello,
I'm a noob in flex. I have no training on it but I try to learn it as
much as I could.
I think my problem is simple to you guys.
I have this in my main.mxml code
<mx:Image x="204" y="7" source="images/-new.gif" visible="false"
id="imgNewMessage"-/>
Now, if I reference it in an action script file like so...
imgNewMessage.-visible=false;
it works fine.
But if I try to do that in a custom control, like this
package mycontrol.container-s
{
import mx.controls.-Alert;
import flash.display.-DisplayObject;
import flash.events.-Event;
import flash.events.-MouseEvent;
import flash.events.-TimerEvent;
import flash.utils.-Timer;
.
.
.
public function doSomething(-):void {
imgNewMessage.-visible=false;
}
}
I'm getting an error. Its like it does'nt know imgNewMessage.
How can I reference it? I thought components are accessible globally.
Hope you guys can help.
Thanks in advance.
No virus found in this outgoing message.
Checked by AVG.
Version: 7.5.516 / Virus Database: 269.19.18/1254 - Release Date: 1/31/2008
8:30 PM