Hi kishore ,

below is the sample where  skins are loaded dynamically from swc .
the swc(in libs folder of zip)   used can be found at the below  url

http://www.scalenine.com/themes/icandy/srcview/iCandy.zip

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="vertical">


<mx:Script>
        <![CDATA[
                import mx.flash.UIMovieClip;
                import flash.utils.getDefinitionByName;
                import mx.collections.ArrayCollection;

                // below variables are used just to keep the defination of 
classses
in  swf file
                // as the compiler removes the classes which are not refrenced  
in
the application
                // for optimization of code
                        var  bb1: Button_skin;
                        var  bb2: RadioButton_icon;
                        var  bb3: DateChooser_nextMonthSkin;
                        var  bb4: Tree_defaultLeafIcon;
                        var  bb5: DateChooser_prevYearSkin;


                [Bindable]
                private var skinColl : ArrayCollection = new
ArrayCollection( ["Button_skin","RadioButton_icon",
                
"DateChooser_nextMonthSkin","Tree_defaultLeafIcon","DateChooser_prevYearSkin"]);

                //this will return the instance of  graphics
                private function getImage(varname : String ):* {
                        return getDefinitionByName(varname) ;
                }

        ]]>
</mx:Script>

        <mx:HBox width="100%"  >
                <mx:Tile direction="horizontal" width="200">
                        <mx:Repeater id="rep2" dataProvider="{skinColl}" >
                                <mx:Image  id="img" 
source="{getImage(String(rep2.currentItem))}" /
>
                                <mx:Text text='{rep2.currentItem }' />
                        </mx:Repeater>
                </mx:Tile>
        </mx:HBox>



</mx:Application>



On Mar 26, 3:50 pm, itonflex team <[email protected]> wrote:
> Hi Friends,
>
>                 This is kishore, i have a requirement that,   i am
> using an images in repeater control. If i am giving the source  of
> that icon from a folder of images its accepting, but now i need to
> give then from an SWC (skinClass). But its not accepting from an SWC.
> I am sending the code, please help me regarding this !
>
>                         <?xml version="1.0" encoding="utf-8"?>
> <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml"; height="300"
> horizontalScrollPolicy="off"  creationComplete="hs.send();"
> backgroundColor="#fafbfc"
> xmlns:ResizableWindow="AppComps.ResizableWindow.*">
>         <mx:HTTPService url="Data.xml" id="hs"
> result="hs_resultHandler(event)"
> fault="Alert.show(event.fault.toString());" resultFormat="e4x" />
>
>         <mx:Script>
>                 <![CDATA[
>
>                 [Bindable]
>                 [Embed(skinClass='iconPlus')]
>                 public var iconPlus1:Class;
>
>                         import mx.core.Application;
>                         import mx.events.ListEvent;
>                         import mx.containers.VBox;
>                         import mx.managers.PopUpManager;
>                 import mx.controls.Alert;
>                 import mx.rpc.events.ResultEvent;
>
>                 [Bindable]
>                 public var xList:XMLList=new XMLList();
>
>                 protected function hs_resultHandler(event:ResultEvent):void
>                 {
>                 //Alert.show(event.result..xmail.repdata.toString());
>                 xList=event.result..xmail.repdata as XMLList;
>                 testfun();
>                 }
>                         [Bindable]
>                         var kk:XMLList=new XMLList();
>                         public function testfun():void
>                         {
>                                         for(var 
> i:int=0;i<xList.children().length();i++)
>                                         {
>                                                 //Alert.show(i+'');
>                                                 
> kk=xList.imgdata[i].children() as XMLList ;
>                                         //      Alert.show(kk+'');
>
>                                         }
>                                 //Alert.show(xList.children().length()+'');
>                                 
> //Alert.show(xList.imgdata[1].children().length()+'');
>                         }
>
>                         //public function 
> eachClick(event:Event,dynmicText:Image):void
>
>                         public static var objNo:int;
>
>                         [Bindable]public static  var kk1:String;
>                         public function eachClick(event:Event):void
>                         {
>                                 //Alert.show(img.+'fghfgh'+img.width+'hjghj');
>                                 kk1=new String();
>                                 kk1=event.currentTarget.source;
>                                 objNo = 0;
>
>                                 
> //Alert.show(event.currentTarget.source,'Nag');
>
>                         }
>
>                         public var kkk:String="@Embed(skinClass='";
>                         public var jj:String="')";
>                         /* public var kkk:String="'"+"@Embed(skinClass='"+"'";
>                         public var jj:String="'"+"')"+"'"; */
>                 ]]>
>         </mx:Script>
>         <mx:Script source="IconScript.as"/>
>
>         <mx:VBox width="100%" height="100%" horizontalAlign="center">
>                         <mx:VBox width="200" >
>                 <mx:Repeater id="rep" dataProvider="{xList}" >
>                         <mx:HBox width="100%"  backgroundColor="#B9C3C6">
>                                 <mx:Label text="{rep.currentit...@txt}"  />
>                         </mx:HBox>
>                         <mx:HBox width="100%"  >
>                                 <mx:Tile direction="horizontal" width="200">
>                                         <mx:Repeater id="rep2"
> dataProvider="{rep.currentItem.imgdata.children()}" >
>
>                                                         <mx:Image  id="img" 
> source="{'images/charts/'+rep2.currentItem
> +'.PNG'}" click="eachClick(event)" />
>
>                                                         <mx:Text 
> text='{kkk+rep2.currentItem+jj}' />
>                                                         <!--<mx:Image  
> id="img" source="{kkk+rep2.currentItem+jj}"
> click="eachClick(event)" />
>                                                         -->
>
>                                         </mx:Repeater>
>                                 </mx:Tile>
>                         </mx:HBox>
>                 </mx:Repeater>
>
>         </mx:VBox>
>
>         </mx:VBox>
> </mx:VBox>
>
> please help me regarding this
>
> this is data.xml
>
> <xml>
>         <xmail>
>                 <repdata txt='Column'>
>                         <imgdata>
>                                 <img1>up</img1>
>                                 <img2>down</img2>
>                                 <img3>top</img3>
>                                 <img4>crossline</img4>
>                                 <img5>n</img5>
>                                 <img6>col6</img6>
>                                 <img7>col7</img7>
>                                 <img8>col8</img8>
>                                 <img9>col9</img9>
>                                 <img10>col10</img10>
>                                 <img11>col11</img11>
>                                 <img12>col12</img12>
>                                 <img13>col13</img13>
>                                 <img14>col14</img14>
>                         </imgdata>
>                 </repdata>
>                 <repdata txt='Line'>
>                         <imgdata>
>                                 <img1>line1</img1>
>                                 <img2>line2</img2>
>                                 <img3>line3</img3>
>                                 <img4>line4</img4>
>                                 <img5>line5</img5>
>                                 <img6>line6</img6>
>                                 <img7>line7</img7>
>                         </imgdata>
>                 </repdata>
>                 <repdata txt='Pie'>
>                         <imgdata>
>                                 <img1>pie1</img1>
>                                 <img2>pie2</img2>
>                                 <img3>pie3</img3>
>                                 <img4>pie4</img4>
>                                 <img5>pie5</img5>
>                                 <img6>pie6</img6>
>                         </imgdata>
>                 </repdata>
>                 <repdata txt='Bar'>
>                         <imgdata>
>                                 <img1>bar1</img1>
>                                 <img2>bar2</img2>
>                                 <img3>bar3</img3>
>                                 <img4>bar4</img4>
>                                 <img5>bar5</img5>
>                                 <img6>bar6</img6>
>                                 <img7>bar7</img7>
>                                 <img8>bar8</img8>
>                                 <img9>bar9</img9>
>                                 <img10>bar10</img10>
>                         </imgdata>
>                 </repdata>
>         </xmail>
> </xml>

-- 
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en.

Reply via email to