List 구성 요소의 캔버스 구성 요소에 제품 정보 묶음을로드하려고합니다.creationcomplete의 대체 메서드
사용자가 내 목록에서 제품을 클릭 할 때마다 제품 세부 정보가 캔버스 구성 요소에 표시됩니다. 제품 세부 정보에 null이 포함되어있을 수 있으며 캔버스 구성 요소에 표시하기 전에 확인해야합니다.
내 캔버스 구성 요소에서 createcomplete를 사용하여 productDetail == null인지 확인한 다음 무언가를 수행합니다. 내 문제는 처음으로 null이 아닌 세부 정보가있는 제품을 클릭하면 사용자가 null 제품 세부 정보를 클릭하면 "if (productDetail == null) then something"문이 실행되지 않는다는 것입니다. 처음 사용자가 null이 아닌 제품 세부 사항을 클릭 할 때 생성됩니다.
제품을 클릭 할 때마다 productDetail == null인지 확인하고 싶습니다 ... 제 질문을 잘 설명하고 도움을 주시면 감사하겠습니다.
내 코드 .. AS
: 내 productDetail 구성 요소에 대한
protected function changeHandler(event:IndexChangeEvent):void{
compDetailinfoResult.token=getCompList.compDetail(event.target.selectedItem.productId);//get the product detail clicked by the user
}
<s:List dataProvider={productData}/> //when user click a product,
//the canvas will show product detail..
<comp:productDetail productData={compDetailinfoResult.lastResult} //custom property
change="changeHandler"/> //if the product detail is
//null, the statement inside
//the canvas will check via
//creationComplete. but if the
//user click the non-null product,
//the creationComplete check pass. User clicks a null product again,
//the check won't work anymore...
코드 : 도움에 대한
public var productData:arrayCollection
protected function canvas1_creationCompleteHandler(event:FlexEvent):void
{
var undefinedBrand:String=dataFromClick.getItemAt(0).brand;
if(undefinedBrand==null){ // I want to check every time the user click a List item
brand.text="Brand: No Brand";
switchView.enabled=false;
displayPictureBig.source="assets/vacant.jpg";
}
}
<s:Panel>
<label id="brand" text="productDate.getItemAt(0).brand"/>
//I want the brand to be displayed..
//but if brand is null..it will display No Brand..
//see AC above...but createComplete only fire once.
//Anyway to keep tracking if the brand that is sent by List is null?
</s:Panel
감사합니다 ..
혼란을 드려 죄송합니다. 나는 단지 여기에 아주 기본적인 코드를 붙인다. 업데이트 된 코드를 참조하십시오 ... – FlyingCat
주 응용 프로그램에서 보낸 데이터가 있습니다. productDetail 구성 요소는 데이터를 수신하여 표시합니다. 제품 세부 정보는 사용자가 목록에서 클릭 한 제품에 따라 달라집니다. 일부 제품 브랜드가 null이고 사용자가 브랜드 없음 제품을 클릭하면 No Brand를 표시하려고합니다 ... 도움을 주셔서 감사합니다 ... : D – FlyingCat