Re: [flexcoders] determine if image source exists

2008-09-30 Thread jitendra jain
Use Embed keyword that will help embedding the image in a class while 
compiling.[Embed(assets/status.png)]
private var status:Class;Thanks,

with Regards,
Jitendra Jain




- Original Message 
From: bhaq1972 [EMAIL PROTECTED]
To: flexcoders@yahoogroups.com
Sent: Tuesday, 30 September, 2008 5:35:19 PM
Subject: [flexcoders] determine if image source exists


How can I check if a the jpg source defined by a string really exists. 
eg

var image1:Image = new Image();
var sHello:String = images/hello. jpg;

if(sHello exists) // this is the bit i need help on
{
image1.source = sHello;
}

tia
bod

  image.source=status; 


  Connect with friends all over the world. Get Yahoo! India Messenger at 
http://in.messenger.yahoo.com/?wm=n/

Re: [flexcoders] determine if image source exists

2008-09-30 Thread Paul Andrews
..but understand that it's no longer an external asset and will be embedded in 
your swf. If the png changes after you publish the swf, the change won't be 
picked up until you republish.
  - Original Message - 
  From: jitendra jain 
  To: flexcoders@yahoogroups.com 
  Sent: Tuesday, September 30, 2008 1:10 PM
  Subject: Re: [flexcoders] determine if image source exists


  Use Embed keyword that will help embedding the image in a class while 
compiling.
  [Embed(assets/status.png)]

  private var status:Class;

   image.source=status; 
  Thanks,

  with Regards,
  Jitendra Jain





  - Original Message 
  From: bhaq1972 [EMAIL PROTECTED]
  To: flexcoders@yahoogroups.com
  Sent: Tuesday, 30 September, 2008 5:35:19 PM
  Subject: [flexcoders] determine if image source exists


  How can I check if a the jpg source defined by a string really exists. 
  eg

  var image1:Image = new Image();
  var sHello:String = images/hello. jpg;

  if(sHello exists) // this is the bit i need help on
  {
  image1.source = sHello;
  }

  tia
  bod





--
  Did you know? You can CHAT without downloading messenger. Click here  

Re: [flexcoders] determine if image source exists

2008-09-30 Thread jitendra jain
Yes, Paul you are absolutely right. Please take a note of this while handling 
with images specially dealing with Embed keyword.
 Thanks,

with Regards,
Jitendra Jain




- Original Message 
From: Paul Andrews [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, 30 September, 2008 5:55:50 PM
Subject: Re: [flexcoders] determine if image source exists


 
..but understand that it's no longer an external asset and will be embedded in 
your swf. If the png changes after you publish the swf, the change won't be 
picked up until you republish.
- Original Message - 
From: jitendra jain 
To: [EMAIL PROTECTED] ups.com 
Sent: Tuesday, September 30, 2008 1:10 PM
Subject: Re: [flexcoders] determine if image source exists

Use Embed keyword that will help embedding the image in a class while 
compiling..[Embed(assets/ status.png )]
private var status:Class; image.source= status; Thanks,

with Regards,
Jitendra Jain




- Original Message 
From: bhaq1972 [EMAIL PROTECTED] com
To: [EMAIL PROTECTED] ups.com
Sent: Tuesday, 30 September, 2008 5:35:19 PM
Subject: [flexcoders] determine if image source exists


How can I check if a the jpg source defined by a string really exists. 
eg

var image1:Image = new Image();
var sHello:String = images/hello. jpg;

if(sHello exists) // this is the bit i need help on
{
image1.source = sHello;
}

tia
bod



Did you know? You can CHAT without downloading messenger. Click here 
__.._,_.___ 
Messages in this topic (3) Reply (via web post) | Start a new topic 
Messages 
--
Flexcoders Mailing List
FAQ: http://groups.yahoo..com/group/flexcoders/files/flexcodersFAQ.txt
Alternative FAQ location: 
https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
 
Change settings via the Web (Yahoo! ID required) 
Change settings via email: Switch delivery to Daily Digest | Switch format to 
Traditional 
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe 
Recent Activity
*  60
New MembersVisit Your Group 
Yahoo! Finance
It's Now Personal
Guides, news,
advice  more.
Real Food Group
Share recipes,
restaurant ratings
and favorite meals.
Best of Y! Groups
Check it out
and nominate your
group to be featured.
. 
 


  Share files, take polls, and make new friends - all under one roof. Go to 
http://in.promos.yahoo.com/groups/

Re: [flexcoders] determine if image source exists

2008-09-30 Thread Scott Melby

You can use a Loader and attempt a load as follows:

 /**
 * The Loader used to load images.
 */
 private var _imageLoader:Loader = new Loader();

...


 var urlRequest:URLRequest = new URLRequest(someURLString);

 try

 {
   _imageLoader.load(urlRequest);
 }
 catch (imageLoadError:Error)
 {
   trace(Unable to load image at ' + someURLString + ':  + 
imageLoadError.message);

  }

You will need to listen to the loader for events.  If it loads, your 
source is ok, if not you will likely get the ioError event... unless you 
have a security issue in which case you will catch the SecurityError 
that gets thrown.


hth
Scott




bhaq1972 wrote:


How can I check if a the jpg source defined by a string really exists.
eg

var image1:Image = new Image();
var sHello:String = images/hello.jpg;

if(sHello exists) // this is the bit i need help on
{
image1.source = sHello;
}

tia
bod