I want to embed images in flash cs4 according to some description. the description value is coming from webservice.
for example-> if the description is "Fair" then i have to display fair.png image or if it is "HeavyRain" then i hav开发者_StackOverflow中文版e to display HeavyRain.png image and so on..
how do i proceed.
can anybody help me out
Thanks in advance.
Sushma
import mx.core.BitmapAsset;
[Embed("assets/Fair.png")]
const Fair:Class;
[Embed("assets/Cldy.png")]
const Cldy:Class;
[Embed("assets/Sunny.png")]
const Sunny:Class;
[Embed("assets/Fog.png")]
const Fog:Class;
var desc:String = new String();
if(desc == "Fair"){
var FairImg:BitmapAsset = new Fair();
TemperatureImageId.addChild(FairImg); //TemperatureImageId is the Id of graphic symbol
} else if(desc == "Cloudy"){
var Cloudy:BitmapAsset = new Cldy();
TemperatureImageId.addChild(Cloudy);
}else if(desc == "Sunny"){
var Sunny:BitmapAsset = new sunny();
TemperatureImageId.addChild(Sunny);
}else if(desc == "Fog"){
var Fog:BitmapAsset = new Fog();
TemperatureImageId.addChild(Fog);
}
精彩评论