Hi Rishi,

Thanks for your help and sorry for the delay,

the following is my MXML component entire code

<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml";
horizontalScrollPolicy="off" verticalScrollPolicy="off"
backgroundColor="0xffffff" width="100%" height="100%">
        <mx:Script>
                <![CDATA[
                        import com.tis.utils.CustomEvents;
                        import mx.controls.Label;
                        import mx.controls.HRule;
                        import mx.containers.HBox;
                        import mx.controls.Text;
                        import com.tis.components.HDashedRule;
                        import com.tis.htmlFilter.htmlText;
                        import com.tis.htmlFilter.htmlFilter;
                        import com.tis.model.ApplicationVars;
                        import flash.utils.setTimeout;
                        import flash.utils.clearTimeout;

                        [Bindable]
                        private var _tabXML:XMLList;
                        private var _mediaXML:XMLList;
                        private var _notesIncluded:Boolean;
                        private var _model:ApplicationVars;
                        private var loadedNotes:XML;
                        private var firstSubTab:Boolean=true;
                        private var printInterval:int;
                        public function createEntireLessonPlan():void{
                                _model = ApplicationVars.getInstance();
                                if(_notesIncluded){
                                        callGetNotesFromServer();
                                }else{
                                        renderAllTabs();
                                }
                        }
                        private function callGetNotesFromServer():void{
                                
_model.addEventListener("notesLoaded",notesXMLLoaded);
                                _model.getAllNotesFromServer();
                        }
                        private function notesXMLLoaded(evt:Event):void
                        {
                                
_model.removeEventListener("notesLoaded",notesXMLLoaded);
                                loadedNotes = _model.loadedNotes;
                                renderAllTabs();
                        }
                        public function renderAllTabs():void{
                                var noTabsToExclude:uint;
                                for(var 
iloop:uint=0;iloop<_tabXML.children().length();iloop++){
                                        
if(_tabXML.children()[iloo...@stereotype=="resource" ||
_tabXML.children()[iloo...@stereotype=="printable"){
                                                noTabsToExclude++;
                                        }
                                }
                                
for(iloop=0;iloop<_tabXML.children().length();iloop++){
                                        var xmlNode:XMLList;
                                        var xmlSubNode:XMLList;
                                        var notesXMLList:XMLList=null;
                                        xmlNode = new 
XMLList(_tabXML.children()[iloop]);
                                        
if(_tabXML.children()[iloo...@stereotype=="resource" ||
_tabXML.children()[iloo...@stereotype=="printable"){

                                        }else{
                                                if(!xmlNode.hasSimpleContent() 
&&
xmlNode.content.toString()==""){
                                                        for(var 
jloop:uint=0;jloop<xmlNode.children().length();jloop+
+){
                                                                xmlSubNode = 
new XMLList(xmlNode.children().
(@referenceId==(jloop+1)));
                                                                
if(_notesIncluded){
                                                                        
notesXMLList = loadedNotes.note.(@sectionid==xmlno...@t_id
&& @subsectionid==xmlsubno...@referenceid);
                                                                }
                                                                
if(jloop<(xmlNode.children().length()-1)){
                                                                        
renderTab(xmlSubNode,true,false,notesXMLList);
                                                                }else{
                                                                        
renderTab(xmlSubNode,true,true,notesXMLList);
                                                                }
                                                                //
trace("@@@@@@@@@@@@@@@@@xmlsubno...@title",xmlSubNode.title.text());
                                                        }
                                                }else{
                                                                
if(_notesIncluded){
                                                                        
notesXMLList = loadedNotes.note.(@sectionid==xmlno...@t_id
&& @subSectionId=="");
                                                                }
                                                                //For adding 
End Line
                                                                
if(iloop<(_tabXML.children().length()-noTabsToExclude-1)){
                                                                        
renderTab(xmlNode,false,true,notesXMLList);
                                                                }else{
                                                                        
renderTab(xmlNode,false,false,notesXMLList);
                                                                }
                                                        
//trace("@@@@@@@@@@@@@@@@@xmlno...@title",xmlno...@title);
                                                }
                                        }
                                }
                        }

                        private function
renderTab(xmlContent:XMLList,isSubTab:Boolean=false,addEndLine:Boolean=false,notesXMLList:XMLList=null):void{
                                var curTabXML:XMLList;
                                var htmlFilterComp:htmlFilter;
                                var notesXML:XML;
                                var notesPrint:NotesPrint;
                                var labelSep:Label;


                                        var titleText:Text = new Text();
                                        //titleText.height = 30;
                                        titleText.setStyle("color","0xB33F04");
                                        
titleText.setStyle("fontFamily","Tahoma");
                                        titleText.setStyle("fontSize",12);
                                        titleText.setStyle("fontWeight","bold");
                                        //
                                        var hRuleHBox:HBox = new HBox();
                                        hRuleHBox.percentWidth = 100;
                                        
hRuleHBox.setStyle("horizontalAlign","center");
                                        var hRule:HRule = new HDashedRule();
                                        hRule.percentWidth = 95;
                                        
hRule.setStyle("strokeColor","0x989898");
                                        hRule.setStyle("dashGap",5);
                                        //hRule.setStyle("strokeWidth",5);


                                        var dumpHtmlTxt:htmlText = new 
htmlText();
                                        dumpHtmlTxt.isOnPrinting=true;
                                        if(isSubTab){
                                                titleText.text = 
xmlContent.title;
        
_model.renderHtmlTextComp(dumpHtmlTxt,xmlContent.content,_mediaXML,
560);
                                        }else{
                                                titleText.text = 
xmlconte...@title;
                                                
_model.renderHtmlTextComp(dumpHtmlTxt,xmlContent,_mediaXML,
560);
                                        }
                                        
//dumpHtmlTxt.setStyle("borderStyle","solid");

                                        contentVBox.minHeight=0;
                                        if(isSubTab && firstSubTab){
                                                firstSubTab = false;
                                                var subTabTitleText:Text = new 
Text();
                                                subTabTitleText.text = 
"Teaching Points";
                                                //titleText.height = 20;
                                                
subTabTitleText.setStyle("color","0xB33F04");
                                                
subTabTitleText.setStyle("fontFamily","Tahoma");
                                                
subTabTitleText.setStyle("fontSize",12);
                                                
subTabTitleText.setStyle("fontWeight","bold");
                                                
contentVBox.addChild(subTabTitleText);
                                        }
                                        contentVBox.addChild(titleText);
                                        contentVBox.addChild(dumpHtmlTxt);
                                        if(notesXMLList){
                                                notesXML= new 
XML("<notes><note/></notes>");
                                                notesXML.replace(0,notesXMLList)
                                                
if(notesXML.children().length()){
                                                        notesPrint = new 
NotesPrint();
                                                        
contentVBox.addChild(notesPrint);
                                                        
//notesPrint.addEventListener("notesCompleted",notesAdded);
                                                        
notesPrint.addNotes(notesXML);

                                                        labelSep = new Label();
                                                        labelSep.height = 10;
                                                        
contentVBox.addChild(labelSep);

                                                }
                                                //trace("!!!!!!!!!!!!!!!!!!!
notesXML",notesXML.children().length(),notesXML);
                                        }
                                        if(addEndLine){
                                                hRuleHBox.addChild(hRule);
                                                contentVBox.addChild(hRuleHBox)
                                                labelSep = new Label();
                                                labelSep.height = 5;
                                                contentVBox.addChild(labelSep);
                                        }
                                        //
dumpHtmlTxt.addEventListener(FlexEvent.UPDATE_COMPLETE,printDataLoaded)
                                        //callGetNotesFromServer();

                        }
                        public function set tabXML(p_xmlList:XMLList):void{
                                _tabXML = p_xmlList;
                        }
                        public function set mediaXML(p_xmlList:XMLList):void{
                                _mediaXML = p_xmlList;
                        }
                        public function get notesIncluded():Boolean{
                                return _notesIncluded;
                        }
                        public function set 
notesIncluded(p_notesIncluded:Boolean):void{
                                _notesIncluded = p_notesIncluded;
                        }
                        public function get PrintBtnInstance():Button{
                                var _printBtn:Button =
printHolderHBox.getChildByName("velpPrintBtn") as Button;
                                return _printBtn;
                        }
                        private function closeWindow():void{
                                //clearTimeout(printInterval);
                                dispatchEvent(new Event("windowClosed"));
                                dispose();
                        }
                        public function btnClicked(e:MouseEvent):void{
                                var clickedObj:Object = e.target;
                                dispatchEvent(new
CustomEvents(CustomEvents.FOOTERBTNCLICK_EVENT,clickedObj.id));
                                printButtonEnable(false)
                                //printInterval = 
setTimeout(printButtonEnable,3000,true);
                        }
                        public function 
printButtonEnable(p_boolean:Boolean):void{
                                var _printBtn:Button =
printHolderHBox.getChildByName("velpPrintBtn") as Button;
                                _printBtn.enabled = p_boolean;
                        }
                        private function dispose():void{
                                //
                                while(contentVBox.numChildren){
                                        contentVBox.removeChildAt(0);
                                }
                                while(topBox.numChildren){
                                        topBox.removeChildAt(0);
                                }
                                while(this.numChildren){
                                        this.removeChildAt(0);
                                }
                        }
                ]]>
        </mx:Script>
        <mx:Box id="topBox" x="3" y="0" height="30"
backgroundColor="0xCDF1FF" borderStyle="solid" borderColor="0x66B1D1"
width="100%" cornerRadius="5">
                <mx:Canvas width="100%" >
                        <mx:HBox paddingLeft="10" horizontalAlign="left" 
width="100%" >
                                <mx:Text selectable="false" text="Entire Lesson 
Plan"
fontSize="12" fontFamily="Arial"  fontWeight="bold" />
                        </mx:HBox>
                        <mx:HBox paddingRight="6" horizontalAlign="right" 
width="100%" >
                                <mx:Text  selectable="false" text="Close" 
fontSize="12"
fontFamily="Arial"   fontWeight="bold" buttonMode="true"
useHandCursor="true" click="closeWindow()"  />
                        </mx:HBox>
                </mx:Canvas>
        </mx:Box>
        <mx:VBox id="contentVBox" paddingLeft="10" x="3" y="19" height="80%"
width="100%" borderStyle="solid" borderColor="0x66B1D1"
verticalScrollPolicy="auto"
verticalScrollBarStyleName="tabVScrollBarStyleName"
backgroundColor="0xffffff">
        </mx:VBox>
        <mx:HBox id="printHolderHBox" y="28" paddingRight="30"
horizontalAlign="right" width="100%" >
                <mx:Button id="velpPrintBtn" styleName="printBtnStyle"
click="btnClicked(event)"/>
        </mx:HBox>
</mx:Canvas>

contentVBox is the Vbox where i am adding all the htmlRenderer
component.

Component starts rendering once the createEntireLessonPlan() function
is called.

Please let me know if you want more details about the code.

-- 
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