10 Replies Latest reply on May 19, 2010 12:52 AM by fimperioli

    Problem in mx:Canvas click handler

    fimperioli

      Hi All,

       

      I'm working on flex builder 3 with flex sdk 3.4.

       

      I've developed my application but, after I run from firefox, when I click on a butto or a checkbox I'm receiving the error message:

       

      TypeError: Error #1009: Cannot access a property or method of a null object reference.

       

          at mx.controls::Button/mouseDownHandler()

       

      I can't upgrade my flex version to 4.

       

      Can you help me ?

       

      regards,

       

      Fabio Imperioli.

       

       

      p.s. If you can, add to this mailing list:  fabio.imperioli@accenture.com

        • 1. Re: Problem in mx:Canvas click handler
          BhaskerChari Level 4

          Can you please post the sample code reproducing the problem or explain your problem in detail.

           

          when you are calling the function mouseDownHandler()...at which line you are getting this error..?

           

           

          Thanks,

          Bhasker Chari

          • 2. Re: Problem in mx:Canvas click handler
            fimperioli Level 1

            Hi Chari,

             

            the error doesn't indicates the error line; below my source code...

             

            <?xml version="1.0" encoding="utf-8"?>
            <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"
                 creationComplete="creationComplete()"
                 implements="com.espertech.esperhq.eventlet.activate.Eventlet"
                 width="1200" height="550">
                
                     <mx:Script>
                     <![CDATA[
                         private function moveCCCPaneTo():void {
                             myMove.end();
                             myMove.xTo=10;
                             myMove.play();
                             expandMostLeftVBox();
                             moveMostLeftVBox();
                         }
                        
                         private function moveCCCPaneFrom():void {
                             myMove.end();
                             myMove.xTo=470;
                             myMove.play();
                             restrictMostLeftVBox();
                             moveMostLeftVBoxResize();
                         }
                        
                         private function expandMostLeftVBox():void {
                             expandNumberOfResponseOKVBox.play();
                             expandNumberOfContentErrorResponseBox.play();
                             expandInternationRoamingContentNECBox.play();
                             expandNumberOfRoamingRequestVBox.play();
                             expandNumberOfContentResponseBox.play();
                             expandInternationRoamingContentBox.play();
                             expandNumberOfContentRequestVBox.play();
                             expandNumberOfIRVBox.play();
                             expandNumberOfCNECResponseBox.play();
                             expandNumberOfRequestVBox.play();
                             expandNumberOfGenericErrorsVBox.play();
                             expandNumberOfNECVBox.play();
                         }
                        
                         private function restrictMostLeftVBox():void {
                             restrictNumberOfResponseOKVBox.play();
                             restrictNumberOfContentErrorResponseBox.play();
                             restrictInternationRoamingContentNECBox.play();
                             restrictNumberOfRoamingRequestVBox.play();
                             restrictNumberOfRoamingRequestVBox.play();
                             restrictNumberOfContentResponseBox.play();
                             restrictInternationRoamingContentBox.play();
                             restrictNumberOfContentRequestVBox.play();
                             restrictNumberOfIRVBox.play();
                             restrictNumberOfCNECResponseBox.play();
                             restrictNumberOfRequestVBox.play();
                             restrictNumberOfGenericErrorsVBox.play();
                             restrictNumberOfNECVBox.play();
                         }
                        
                         private function moveMostLeftVBox():void {
                             myMoveNumberOfResponseOK.end();
                             myMoveNumberOfResponseOK.xTo=790;
                             myMoveNumberOfResponseOK.play();
                            
                             myMoveNumberOfContentErrorResponseBox.end();
                             myMoveNumberOfContentErrorResponseBox.xTo=790;
                             myMoveNumberOfContentErrorResponseBox.yTo=120; //196
                             myMoveNumberOfContentErrorResponseBox.play();
                            
                            
                             myMoveInternationRoamingContentNECBox.end();
                             myMoveInternationRoamingContentNECBox.xTo=790;
                             myMoveInternationRoamingContentNECBox.yTo=230; //196
                             myMoveInternationRoamingContentNECBox.play();
                             //roaming,numberOfContentResponseBox,internationRoamingContentBox
                             myMoveNumberOfRoamingRequestVBox.end();
                             myMoveNumberOfRoamingRequestVBox.xTo=540;
                             myMoveNumberOfRoamingRequestVBox.play();
                            
                             myMoveNumberOfContentResponseBox.end();
                             myMoveNumberOfContentResponseBox.xTo=540;
                             myMoveNumberOfContentResponseBox.yTo=120; //196
                            
                             myMoveNumberOfContentResponseBox.play();
                            
                            
                             myMoveInternationRoamingContentBox.end();
                             myMoveInternationRoamingContentBox.xTo=540;
                             myMoveInternationRoamingContentBox.yTo=230; //196
                             myMoveInternationRoamingContentBox.play();
                             //myMoveNumberOfContentRequestVBox,myMoveNumberOfIRVBox,myMoveNumberOfCNECResponseBox
                            
                             myMoveNumberOfContentRequestVBox.end();
                             myMoveNumberOfContentRequestVBox.xTo=275;
                             myMoveNumberOfContentRequestVBox.yTo=10;
                            
                             myMoveNumberOfContentRequestVBox.play();
                             myMoveNumberOfIRVBox.end();
                             myMoveNumberOfIRVBox.xTo=275;
                             myMoveNumberOfIRVBox.yTo=120; //196
                             myMoveNumberOfIRVBox.play();
                             myMoveNumberOfCNECResponseBox.end();
                             myMoveNumberOfCNECResponseBox.xTo=275;
                             myMoveNumberOfCNECResponseBox.yTo=230;
                             myMoveNumberOfCNECResponseBox.play();
                            
                             //myMoveNumberOfRequestVBox,myMoveNumberOfGenericErrorsVBox,myMoveNumberOfNECVBox
                             myMoveNumberOfRequestVBox.end();
                             myMoveNumberOfRequestVBox.xTo=10;
                             myMoveNumberOfRequestVBox.yTo=10; //196
                             myMoveNumberOfRequestVBox.play();
                             myMoveNumberOfGenericErrorsVBox.end();
                             myMoveNumberOfGenericErrorsVBox.xTo=10;
                             myMoveNumberOfGenericErrorsVBox.yTo=120; //196
                             myMoveNumberOfGenericErrorsVBox.play();
                            
                             myMoveNumberOfNECVBox.end();
                             myMoveNumberOfNECVBox.xTo=10;
                             myMoveNumberOfNECVBox.yTo=230; //196
                             myMoveNumberOfNECVBox.play();
                            
                         }
                        
                         private function moveMostLeftVBoxResize():void {
                             myMoveNumberOfResponseOK.end();
                             myMoveNumberOfResponseOK.xTo=535;
                             myMoveNumberOfResponseOK.play();
                             myMoveNumberOfContentErrorResponseBox.end();
                             myMoveNumberOfContentErrorResponseBox.xTo=535;
                            
                             myMoveNumberOfContentErrorResponseBox.yTo=103; //196--
                            
                             myMoveNumberOfContentErrorResponseBox.play();
                             myMoveInternationRoamingContentNECBox.end();
                             myMoveInternationRoamingContentNECBox.xTo=535;
                             myMoveInternationRoamingContentNECBox.yTo=196;
                             myMoveInternationRoamingContentNECBox.play();
                             //roaming,numberOfContentResponseBox,internationRoamingContentBox
                             myMoveNumberOfRoamingRequestVBox.end();
                             myMoveNumberOfRoamingRequestVBox.xTo=362;
                             myMoveNumberOfRoamingRequestVBox.play();
                             myMoveNumberOfContentResponseBox.end();
                             myMoveNumberOfContentResponseBox.xTo=362;
                            
                             myMoveNumberOfContentResponseBox.yTo=103; //196
                            
                             myMoveNumberOfContentResponseBox.play();
                             myMoveInternationRoamingContentBox.end();
                             myMoveInternationRoamingContentBox.xTo=362;
                             myMoveInternationRoamingContentBox.yTo=196;
                             myMoveInternationRoamingContentBox.play();
                             //myMoveNumberOfContentRequestVBox,restrictNumberOfIRVBox,myMoveNumberOfCNECResponseBox
                             myMoveNumberOfContentRequestVBox.end();
                             myMoveNumberOfContentRequestVBox.xTo=187;
                            
                             myMoveNumberOfContentRequestVBox.play();
                             myMoveNumberOfIRVBox.end();
                             myMoveNumberOfIRVBox.xTo=187;
                             myMoveNumberOfIRVBox.yTo=103;
                             myMoveNumberOfIRVBox.play();
                             myMoveNumberOfCNECResponseBox.end();
                             myMoveNumberOfCNECResponseBox.xTo=187;
                             myMoveNumberOfCNECResponseBox.yTo=196;
                             myMoveNumberOfCNECResponseBox.play();
                             //myMoveNumberOfRequestVBox,myMoveNumberOfGenericErrorsVBox,myMoveNumberOfNECVBox
                             myMoveNumberOfRequestVBox.end();
                             myMoveNumberOfRequestVBox.xTo=10;
                             myMoveNumberOfRequestVBox.play();
                             myMoveNumberOfGenericErrorsVBox.end();
                             myMoveNumberOfGenericErrorsVBox.xTo=10;
                             myMoveNumberOfGenericErrorsVBox.yTo=100;
                            
                             myMoveNumberOfGenericErrorsVBox.play();
                             myMoveNumberOfNECVBox.end();
                             myMoveNumberOfNECVBox.xTo=10;
                             myMoveNumberOfNECVBox.yTo=196;
                             myMoveNumberOfNECVBox.play();
                         }
                        
                     ]]>
                 </mx:Script>
                
                
                 <mx:Move id="myMove" target="{CCCMainPanel}"/>
                 <mx:Dissolve id="dissolveOut" duration="1000" alphaFrom="1.0" alphaTo="0.0"/>
                 <mx:Dissolve id="dissolveIn" duration="1000" alphaFrom="0.0" alphaTo="1.0"/>
                 <mx:Resize id="expand" target="{CCCMainPanel}" widthTo="1024" heightTo="408"/>
                 <mx:Resize id="contract" target="{CCCMainPanel}" widthTo="715" heightTo="408"/>
                
                 <mx:Move id="myMoveNumberOfResponseOK" target="{numberOfOKResponseVBox}"/>
                 <mx:Move id="myMoveNumberOfContentErrorResponseBox" target="{numberOfContentErrorResponseBox}"/>
                 <mx:Move id="myMoveInternationRoamingContentNECBox" target="{internationRoamingContentNECBox}" />
                 <mx:Move id="myMoveNumberOfRoamingRequestVBox" target="{numberOfRoamingRequestVBox}" />
                 <mx:Move id="myMoveNumberOfContentResponseBox" target="{numberOfContentResponseBox}" />
                 <mx:Move id="myMoveInternationRoamingContentBox" target="{internationRoamingContentBox}" />
                 <mx:Move id="myMoveNumberOfContentRequestVBox" target="{numberOfContentRequestVBox}" />
                 <mx:Move id="myMoveNumberOfIRVBox" target="{numberOfIRVBox}" />
                 <mx:Move id="myMoveNumberOfCNECResponseBox" target="{numberOfCNECResponseBox}" />
                 <mx:Move id="myMoveNumberOfRequestVBox" target="{numberOfRequestVBox}" />
                 <mx:Move id="myMoveNumberOfGenericErrorsVBox" target="{numberOfGenericErrorsVBox}" />
                 <mx:Move id="myMoveNumberOfNECVBox" target="{numberOfNECVBox}" />
                
                 <mx:Resize id="expandNumberOfResponseOKVBox" target="{numberOfOKResponseVBox}" widthTo="205" heightTo="85" />
                
                 <mx:Resize id="expandNumberOfContentErrorResponseBox" target="{numberOfContentErrorResponseBox}" widthTo="205" heightTo="85" />
                
                
                 <mx:Resize id="expandInternationRoamingContentNECBox" target="{internationRoamingContentNECBox}" widthTo="205" heightTo="85" />
                
                 <mx:Resize id="expandNumberOfRoamingRequestVBox" target="{numberOfRoamingRequestVBox}" widthTo="210" heightTo="85" />
                
                 <mx:Resize id="expandNumberOfContentResponseBox" target="{numberOfContentResponseBox}" widthTo="210" heightTo="85" />
                
                 <mx:Resize id="expandInternationRoamingContentBox" target="{internationRoamingContentBox}" widthTo="210" heightTo="85" />
                 <mx:Resize id="expandNumberOfContentRequestVBox" target="{numberOfContentRequestVBox}" widthTo="210" heightTo="85" />
                
                
                 <mx:Resize id="expandNumberOfIRVBox" target="{numberOfIRVBox}" widthTo="210" heightTo="85" />
                 <mx:Resize id="expandNumberOfCNECResponseBox" target="{numberOfCNECResponseBox}" widthTo="208" heightTo="85" />
                
                 <mx:Resize id="expandNumberOfRequestVBox" target="{numberOfRequestVBox}" widthTo="210" heightTo="85" />
                
                 <mx:Resize id="expandNumberOfGenericErrorsVBox" target="{numberOfGenericErrorsVBox}" widthTo="210" heightTo="85" />
                 <mx:Resize id="expandNumberOfNECVBox" target="{numberOfNECVBox}" widthTo="210" heightTo="85" />
                
                 <mx:Resize id="restrictNumberOfResponseOKVBox" target="{numberOfOKResponseVBox}" widthTo="156" heightTo="76" />
                 <mx:Resize id="restrictNumberOfContentErrorResponseBox" target="{numberOfContentErrorResponseBox}" widthTo="150" heightTo="76" />
                 <mx:Resize id="restrictInternationRoamingContentNECBox" target="{internationRoamingContentNECBox}" widthTo="150" heightTo="76" />
                 <mx:Resize id="restrictNumberOfRoamingRequestVBox" target="{numberOfRoamingRequestVBox}" widthTo="150" heightTo="76" />
                 <mx:Resize id="restrictNumberOfContentResponseBox" target="{numberOfContentResponseBox}" widthTo="150" heightTo="76" />
                 <mx:Resize id="restrictInternationRoamingContentBox" target="{internationRoamingContentBox}" widthTo="150" heightTo="76" />
                 <mx:Resize id="restrictNumberOfContentRequestVBox" target="{numberOfContentRequestVBox}" widthTo="150" heightTo="76" />
                 <mx:Resize id="restrictNumberOfIRVBox" target="{numberOfIRVBox}" widthTo="150" heightTo="76" />
                
                 <mx:Resize id="restrictNumberOfCNECResponseBox" target="{numberOfCNECResponseBox}" widthTo="150" heightTo="76" />
                 <mx:Resize id="restrictNumberOfRequestVBox" target="{numberOfRequestVBox}" widthTo="150" heightTo="76" />
                 <mx:Resize id="restrictNumberOfGenericErrorsVBox" target="{numberOfGenericErrorsVBox}" widthTo="150" heightTo="76" />
                 <mx:Resize id="restrictNumberOfNECVBox" target="{numberOfNECVBox}" widthTo="150" heightTo="76" />
                
                
                     <mx:Label text="CCC Global View" width="326" height="39" textAlign="left" fontWeight="bold" fontSize="34" color="#040404" x="434.5" y="10"/>
                     <mx:Panel x="10" y="72" width="440" height="408" layout="absolute" title="Threshold Administration Panel"
                               backgroundColor="#E8E8E8" color="#0A0C0C"
                               horizontalAlign="center" borderStyle="solid" borderColor="#D4D8DB" borderThickness="0" fontSize="12"
                               visible="{cb1.selected}"
                               hideEffect="{dissolveOut}" showEffect="{dissolveIn}">
                         <mx:Form x="10" y="-9" width="400" height="367" id="controlForm" label="threshold configuration" borderColor="#B3BEC6" borderStyle="solid" backgroundColor="#F0ECEC">
                             <mx:FormItem label="Total Request Threshold:" fontSize="12" fontStyle="italic" fontWeight="bold" horizontalAlign="left">
                             </mx:FormItem>
                             <mx:FormItem label="Total Request Warning:" fontWeight="bold" width="355" fontSize="10">
                                 <mx:TextInput width="163" id="totalRequestWarningID" />
                             </mx:FormItem>
                             <mx:FormItem label="Total Request Alert:" fontWeight="bold" width="355" fontSize="10">
                                 <mx:TextInput width="163" id="totalRequestAlertID" />
                             </mx:FormItem>
                             <mx:Button label="Apply Filter" id="applyFilterForTotalRequest"  fontSize="10" click="applyFilterForTotalRequestFunc()"/>
                             <mx:FormItem label="Total Content Threshold:" fontSize="12" fontStyle="italic" fontWeight="bold">
                             </mx:FormItem>
                             <mx:FormItem label="Total Content Warning:" fontWeight="bold" width="355" fontSize="10">
                                 <mx:TextInput width="163" id="totalContentWarningID" />
                             </mx:FormItem>
                             <mx:FormItem label="Total Content Alert:" fontWeight="bold" width="355" fontSize="10">
                                 <mx:TextInput width="163" id="totalContentAlertID" />
                             </mx:FormItem>
                             <mx:Button label="Apply Filter" id="applyFilterForTotalRequest0"  fontSize="10" click="applyFilterForTotalContentRequestFunc()"/>
                             <mx:FormItem label="Total Roaming Threshold:" fontSize="12" fontStyle="italic" fontWeight="bold">
                             </mx:FormItem>
                             <mx:FormItem label="Total Roaming Warning:" fontWeight="bold" width="355" fontSize="10">
                                 <mx:TextInput width="163" id="totalRoamingWarningID"/>
                             </mx:FormItem>
                             <mx:FormItem label="Total Roaming Alert:" fontWeight="bold" width="355" fontSize="10">
                                 <mx:TextInput width="163" id="totalRoamingAlertID"/>
                             </mx:FormItem>
                             <mx:Button label="Apply Filter" id="applyFilterForTotalRequest1"  fontSize="10" click="applyFilterForTotalRoamingRequestFunc()"/>
                         </mx:Form>
                     </mx:Panel>
                     <mx:Panel id="CCCMainPanel" width="715" height="408" layout="absolute" color="#0A0C0C" horizontalAlign="center" y="72" x="470">
                         <mx:VBox x="10" y="10" width="150" height="76" id="numberOfRequestVBox"
                                  borderColor="#D1DFE8" themeColor="#77A5C2" backgroundColor="#DAD7D7" cornerRadius="25" borderThickness="0"
                                  borderStyle="solid" horizontalAlign="center" verticalAlign="middle">
                             <mx:Label text="Total Requests" width="149" fontWeight="bold" id="numberOfRequestVBoxTitle" textAlign="center"/>
                             <mx:Label text="0" width="150" height="52" id="numberOfRequestValueLabel" textAlign="center" fontSize="20"/>
                         </mx:VBox>
                         <mx:VBox x="187" y="10" width="150" height="76" id="numberOfContentRequestVBox"
                                  borderColor="#D1DFE8" themeColor="#77A5C2" backgroundColor="#DAD7D7" cornerRadius="25" borderThickness="0" borderStyle="solid" horizontalAlign="center" verticalAlign="middle">
                             <mx:Label text="Content" width="142" fontWeight="bold" id="numberOfContentRequestVBoxTitle" textAlign="center"/>
                             <mx:Label text="0" width="145" height="52" id="numberOfContentRequestValueLabel" textAlign="center" fontSize="20"/>
                         </mx:VBox>
                         <mx:VBox x="362" y="10" width="150" height="76" id="numberOfRoamingRequestVBox"
                                  borderColor="#D1DFE8" themeColor="#77A5C2" backgroundColor="#DAD7D7" cornerRadius="25" borderThickness="0" borderStyle="solid" horizontalAlign="center" verticalAlign="middle">
                             <mx:Label text="Roaming" width="150" fontWeight="bold" id="numberOfRoamingContentRequestVBoxTitle" textAlign="center"/>
                             <mx:Label text="0" width="149" height="52" id="numberOfRoamingRequestValueLabel" textAlign="center" fontSize="20"/>
                         </mx:VBox>
                         <mx:VBox x="535" y="10" width="150" height="76" id="numberOfOKResponseVBox"
                                  borderColor="#D1DFE8" themeColor="#77A5C2" backgroundColor="#DAD7D7" cornerRadius="25" borderThickness="0" borderStyle="solid" horizontalAlign="center" verticalAlign="middle">
                             <mx:Label text="Responses OK" width="124" fontWeight="bold" id="numberOfResponseOKVBoxTitle" textAlign="center"/>
                             <mx:Label text="0" width="125" height="46" id="numberOfResponseValueLabel" textAlign="center" fontSize="20"/>
                         </mx:VBox>
                         <mx:VBox x="10" y="103" width="150" height="76" id="numberOfGenericErrorsVBox"
                                  borderColor="#D1DFE8" themeColor="#77A5C2" backgroundColor="#DAD7D7" cornerRadius="25" borderThickness="0" borderStyle="solid" horizontalAlign="center" verticalAlign="middle">
                             <mx:Label text="Generic Errors" width="117" fontWeight="bold" id="numberOfGenericErrorsVBoxTitle" textAlign="center"/>
                             <mx:Label text="0" width="130" height="41" id="numberOfGenericErrorsValueLabe" textAlign="center" fontSize="20"/>
                         </mx:VBox>
                         <mx:VBox x="10" y="196" width="150" height="76" id="numberOfNECVBox"
                                  borderColor="#D1DFE8" themeColor="#77A5C2" backgroundColor="#DAD7D7" cornerRadius="25" borderThickness="0" borderStyle="solid" horizontalAlign="center" verticalAlign="middle">
                             <mx:Label text="Not Enough Credit" width="119" fontWeight="bold" id="numberOfNECVBoxTitle" textAlign="center"/>
                             <mx:Label text="0" width="130" height="52" id="numberOfNECValueLabel" textAlign="center" fontSize="20"/>
                         </mx:VBox>
                         <mx:VBox x="187" y="103" width="150" height="76" id="numberOfIRVBox"
                                  borderColor="#D1DFE8" themeColor="#77A5C2" backgroundColor="#DAD7D7" cornerRadius="25" borderThickness="0" borderStyle="solid" horizontalAlign="center" verticalAlign="middle">
                             <mx:Label text="International Roaming" width="119" fontWeight="bold" id="numberOfIRBoxTitle" textAlign="center"/>
                             <mx:Label text="0" width="130" height="44" id="numberOfIRValueLabel" textAlign="center" fontSize="20"/>
                         </mx:VBox>
                         <mx:VBox x="362" y="103" width="150" height="76" id="numberOfContentResponseBox"
                                  borderColor="#D1DFE8" themeColor="#77A5C2" backgroundColor="#DAD7D7" cornerRadius="25" borderThickness="0" borderStyle="solid" horizontalAlign="center" verticalAlign="middle">
                             <mx:Label text="Content Responses" width="119" fontWeight="bold" id="numberOfContentoResponseBoxTitle" textAlign="center"/>
                             <mx:Label text="0" width="130" height="47" id="numberOfContentResponseValueLabel" textAlign="center" fontSize="20"/>
                         </mx:VBox>
                         <mx:VBox x="535" y="103" width="150" height="76" id="numberOfContentErrorResponseBox"
                                  borderColor="#D1DFE8" themeColor="#77A5C2" backgroundColor="#DAD7D7" cornerRadius="25" borderThickness="0" borderStyle="solid" horizontalAlign="center" verticalAlign="middle">
                             <mx:Label text="Content Errors" width="119" fontWeight="bold" id="numberOfContentoErrorResponseBoxTitle" textAlign="center"/>
                             <mx:Label text="0" width="130" height="45" id="numberOfContentErrorResponseValueLabel" textAlign="center" fontSize="20"/>
                         </mx:VBox>
                         <mx:VBox x="187" y="196" width="150" height="76" id="numberOfCNECResponseBox"
                                  borderColor="#D1DFE8" themeColor="#77A5C2" backgroundColor="#DAD7D7" cornerRadius="25" borderThickness="0" borderStyle="solid" horizontalAlign="center" verticalAlign="middle">
                             <mx:Label text="Content N.E.C." width="119" fontWeight="bold" id="numberOfContentoNECBoxTitle" textAlign="center"/>
                             <mx:Label text="0" width="130" height="52" id="numberOfContentNECValueLabel" textAlign="center" fontSize="20"/>
                         </mx:VBox>
                         <mx:VBox x="362" y="196" width="150" height="76" id="internationRoamingContentBox"
                                  borderColor="#D1DFE8" themeColor="#77A5C2" backgroundColor="#DAD7D7" cornerRadius="25" borderThickness="0" borderStyle="solid" horizontalAlign="center" verticalAlign="middle">
                             <mx:Label text="Int. Roaming Content" width="119" fontWeight="bold" id="internationRoamingContentBoxTitle" textAlign="center"/>
                             <mx:Label text="0" width="130" height="53" id="internationRoamingContentValueLabel" textAlign="center" fontSize="20"/>
                         </mx:VBox>
                         <mx:VBox x="535" y="196" width="150" height="76" id="internationRoamingContentNECBox"
                                  borderColor="#D1DFE8" themeColor="#77A5C2" backgroundColor="#DAD7D7" cornerRadius="25" borderThickness="0" borderStyle="solid" horizontalAlign="center" verticalAlign="middle">
                             <mx:Label text="N.E.C. Int. Roaming Content" width="118" fontWeight="bold" id="internationRoamingContentNECBoxTitle" textAlign="center"/>
                             <mx:Label text="0" width="119" height="53" id="internationRoamingContentNECValueLabel" textAlign="center" fontSize="20"/>
                         </mx:VBox>
                        
                         <mx:ControlBar>
                             <mx:CheckBox id="cb1" label="show Threshold Administration Panel" selected="true"/>
                             <mx:Button label="Expand" click="moveCCCPaneTo(); expand.end(); expand.play();"/>
                             <mx:Button label="Contract" click="moveCCCPaneFrom(); contract.end(); contract.play();"/>
                             <mx:CheckBox id="cb2" label="Open Chart View" selected="false"/>
                         </mx:ControlBar>
                     </mx:Panel>
                    
                    
                     <mx:Script>
                         <![CDATA[
                            
                             import com.espertech.esperhq.common.bind.*;
                             import com.espertech.esperhq.common.util.*;
                             import com.espertech.esperhq.eventlet.activate.*;
                            
                             import flash.display.BlendMode;
                             import flash.events.Event;
                             import flash.external.ExternalInterface;
                            
                             import mx.controls.Alert;
                            
                            
                             private var isInitialized:Boolean = false;
                             private var typeData:Array = new Array;
                             private var administrationPaneCreationComplete:Boolean = false;
                             private var totalRequestWarn:Number = 5000;
                             private var totalRequestCrit:Number = 2500;
                             private var totalContentWarn:Number = 5000;
                             private var totalContentCrit:Number = 2500;
                             private var totalRoamingWarn:Number = 5000;
                             private var totalRoamingCrit:Number = 2500;
                            
                            
                            
                            
                             // Receive eventlet configuration       
                             public function configureEventlet(context:EventletConfigContext) : String {                   
                                 return null;
                             }
                            
                             // Receive eventlet data source information       
                             public function initializeEventlet(context:EventletInitContext) : void {
                                 for each (var sourceDesc:ActivationSourceDesc in context.sources) {
                                     processManifest(sourceDesc.optionalManifest);                   
                                 }    
                             }
                            
                             private function processManifest(m:SourceManifestDesc) : void {
                                 if (m == null) {
                                     return;
                                 }
                                 var typeName:String = TargetRenderUtil.getTargetName(m.target);
                                 typeData[m.typeId] = typeName;
                             }
                            
                             // Set eventlet container services and register for container events
                             public function setContainer(context:EventletContainerContext) : void {
                                 context.containerDispatcher.addEventListener(EventletContainerEvent.CLEAR, onContainerClear);
                             }
                            
                             private function onContainerClear() : void {
                                
                             }
                            
                            
                            
                             // Called by Flex before rendering the eventlet
                             private function creationComplete() : void {
                                 numberOfRequestVBox.setStyle("backgroundColor","#CC0000");       
                                 numberOfContentRequestVBox.setStyle("backgroundColor","#CC0000");
                                 numberOfRoamingRequestVBox.setStyle("backgroundColor","#CC0000");
                                 numberOfOKResponseVBox.setStyle("backgroundColor","#CC0000");
                                 numberOfGenericErrorsVBox.setStyle("backgroundColor","#CC0000");
                                 numberOfNECVBox.setStyle("backgroundColor","#CC0000");
                                 numberOfIRVBox.setStyle("backgroundColor","#CC0000");
                                 numberOfContentResponseBox.setStyle("backgroundColor","#CC0000");
                                 numberOfContentErrorResponseBox.setStyle("backgroundColor","#CC0000");
                                 numberOfCNECResponseBox.setStyle("backgroundColor","#CC0000");
                                 internationRoamingContentBox.setStyle("backgroundColor","#CC0000");
                                 internationRoamingContentNECBox.setStyle("backgroundColor","#CC0000");
                                
                                
                                
                                 //applyFilterButton.addEventListener(MouseEvent.MOUSE_DOWN,applyFilter);
                                
                                 //call from javascript
                                 //ExternalInterface.addCallback("sendToActionscript", callFromJavaScript);
                                
                                 isInitialized = true;
                                 //trace("called creationComplete");
                             }
                            
                             private function callFromJavaScript(key:String,threshold:String):void{
                                 internationRoamingContentNECValueLabel.text = key;
                             }
                            
                             private function applyFilterForTotalRequestFunc():void {
                                
                                 totalRequestWarningID.blendMode = BlendMode.NORMAL;
                                 totalRequestAlertID.blendMode = BlendMode.NORMAL;
                                 totalRequestWarn = int(totalRequestWarningID.text);
                                 totalRequestCrit = int(totalRequestAlertID.text);
                                 Alert.show('Changes appliyed successfully for Total Request.\ntotal Request Warn:' + totalRequestWarn + "\ntotal Request Crit:" + totalRequestCrit, 'CCC Global View Control Panel Threshold Settings', mx.controls.Alert.OK);
                             }
                            
                             private function applyFilterForTotalContentRequestFunc():void {
                                
                                 totalContentWarningID.blendMode = BlendMode.NORMAL;
                                 totalContentAlertID.blendMode = BlendMode.NORMAL;
                                 totalContentWarn = int(totalContentWarningID.text);
                                 totalContentCrit = int(totalContentAlertID.text);
                                 Alert.show('Changes appliyed successfully for Total Content.\ntotal Content Request Warn:' + totalContentWarn + "\ntotal Content Request Crit:" + totalContentCrit, 'CCC Global View Control Panel Threshold Settings', mx.controls.Alert.OK);
                             }
                            
                             private function applyFilterForTotalRoamingRequestFunc():void {
                                
                                 totalRoamingWarningID.blendMode = BlendMode.NORMAL;
                                 totalRoamingAlertID.blendMode = BlendMode.NORMAL;
                                 totalRoamingWarn = int(totalRoamingWarningID.text);
                                 totalRoamingCrit = int(totalRoamingAlertID.text);
                                 Alert.show('Changes appliyed successfully for Total Roaming.\ntotal Roaming Request Warn:' + totalRoamingWarn + "\ntotal Roaming Request Crit:" + totalRoamingCrit, 'CCC Global View Control Panel Threshold Settings', mx.controls.Alert.OK);
                             }
                            
                            
                            
                             // Receive new event type information as an array of EventManifestDesc
                             public function manifest(entries:Array) : void {   
                                 for each (var m:EventManifestDesc in entries) {
                                     processManifest(m.manifest);
                                     //trace("loading manifest");
                                 }   
                             }
                            
                             // Receive events as an array of EventMessageDesc
                             public function update(entries:Array) : void {
                                 //trace("called update");
                                 if (!isInitialized) {
                                     return;
                                 }
                                 // Process each event           
                                 for each (var eventEntry:EventEntryDesc in entries) {
                                     for each (var event:Object in eventEntry.newRows) {
                                         displayEvent(eventEntry.typeId, event);
                                     }
                                 }
                                 //numberOfRequestLabel.htmlText = "update";
                             }
                            
                             private function displayEvent(typeId:Number, event:Object) : void {
                                
                                 //trace("called displayEvent");
                                
                                 var typeName:String = typeData[typeId];
                                 if (typeName == null) {
                                     typeName = "unknown";
                                 }
                                
                                 //numberOfRequestLabel.text = "typeName:" + typeName;
                                 for (var key:String in event) {
                                    
                                     var value:Object = event[key];
                                     if(key=="ReserveUnitReqCountKPI"){
                                         if (value != null) {
                                             numberOfRequestValueLabel.text = value.toString();
                                             if(value==totalRequestCrit){
                                                 numberOfRequestVBox.setStyle("backgroundColor","#FFCC33");
                                             }else if(value>totalRequestWarn){
                                                 numberOfRequestVBox.setStyle("backgroundColor","#00CC66");
                                             }
                                         }else{
                                             numberOfRequestValueLabel.text = "null";
                                         }
                                        
                                     }else if(key=="ContentKPI"){
                                         if (value != null) {
                                             numberOfContentRequestValueLabel.text = value.toString();
                                             if(value==totalContentCrit){
                                                 numberOfContentRequestVBox.setStyle("backgroundColor","#FFCC33");
                                             }else if(value>totalContentWarn){
                                                 numberOfContentRequestVBox.setStyle("backgroundColor","#00CC66");
                                             }
                                         }else{
                                             numberOfContentRequestValueLabel.text = "null";
                                         }
                                     }else if(key=="ContentRoamingKPI"){
                                         if (value != null) {
                                             numberOfRoamingRequestValueLabel.text = value.toString();
                                             if(value==totalRoamingCrit){
                                                 numberOfRoamingRequestVBox.setStyle("backgroundColor","#FFCC33");
                                             }else if(value>totalRoamingWarn){
                                                 numberOfRoamingRequestVBox.setStyle("backgroundColor","#00CC66");
                                             }
                                         }else{
                                             numberOfRoamingRequestValueLabel.text = "null";
                                         }
                                     }   
                                 }
                             }
                         ]]>
                     </mx:Script>
                
            </mx:Canvas>

             

            thanks for your support,

             

            p.s. for I work for Accenture Italy

            • 3. Re: Problem in mx:Canvas click handler
              BhaskerChari Level 4

              Hi,

               

              It will defenitely show the error in the FlexBuilder for this issue...just check once the problems by going into ...Window >> problems in FlexBuilder

               

               

              Because with the code you posted I cant trace out the error because I cant run the app...since it misses many of the includes...

               

              So if you can check it once or try to debug the problem by using the Flex debugging....environment.

               

              Thanks,

              Bhasker Chari.S

              • 4. Re: Problem in mx:Canvas click handler
                fimperioli Level 1

                thanks for your suggestion;

                 

                In debug mode on flex builder I've the error:

                 

                SWF] C:\Users\fabio.imperioli\Documents\Flex Builder 3\POCPoste\bin-debug\POCPosteWithChart.swf - 789.007 bytes after decompression

                Error: No class registered for interface 'mx.styles::IStyleManager2'.

                at mx.core::Singleton$/getInstance()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx \core\Singleton.as:111]

                at mx.styles::StyleManager$/get impl()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\styles\StyleManager.as:78]

                at mx.styles::StyleManager$/http://www.adobe.com/2006/flex/mx/internal::initProtoChainRoots()[C:\autobuild\3.5.0\frame works\projects\framework\src\mx\styles\StyleManager.as:144]

                at POCPosteWithChart/http://www.adobe.com/2006/flex/mx/internal::_POCPosteWithChart_StylesInit()[C:\Users\fabio .imperioli\Documents\Flex Builder 3\POCPoste\src\POCPosteWithChart.mxml:0]

                at POCPosteWithChart()[C:\Users\fabio.imperioli\Documents\Flex Builder 3\POCPoste\src\POCPosteWithChart.mxml:360]

                 

                 

                I hope this can be more helpfull...

                 

                Fabio

                • 5. Re: Problem in mx:Canvas click handler
                  BhaskerChari Level 4

                  Hi,

                   

                  Try to include the below line in preinitialize event of the file "POCPosteWithChart.mxml" and run the application and check whether this error still exists..?

                   

                  Singleton.registerClass(“mx.styles::IStyleManager2″, Class(ApplicationDomain.currentDomain.getDefinition(“mx.styles::StyleManagerImpl”)));

                   

                  preinitialize="onPreinitialize()" in your root tag of the POCPosteWithChart.mxml file

                   

                  private function onPreinitialize():void

                  {

                       Singleton.registerClass(“mx.styles::IStyleManager2″, Class(ApplicationDomain.currentDomain.getDefinition(“mx.styles::StyleManagerImpl”)));    

                  }

                   

                  If this post answers your question or helps, please mark it as such. All the best..

                   

                   

                  Thanks,

                  Bhasker Chari

                  • 6. Re: Problem in mx:Canvas click handler
                    fimperioli Level 1

                    Thanks for your suport, but after I wrote the code below:

                     

                    ...

                     

                    preinitialize="onPreinitialize()"

                    width="

                     

                    1200" height="550">

                     

                     

                     

                    <mx:Script>

                    <![CDATA[

                     

                     

                     

                    private function onPreinitialize():void

                    {

                    Singleton.registerClass(

                     

                    "mx.styles::IStyleManager2", Class(ApplicationDomain.currentDomain.getDefinition("mx.styles::StyleManagerImp l")));

                    }

                     

                    ...

                     

                    The problem remains...

                     

                    Fabio

                    • 7. Re: Problem in mx:Canvas click handler
                      fimperioli Level 1

                      If I try to run my component from another application like:

                       

                      <?xml version="1.0" encoding="utf-8"?>

                      <mx:Application

                       

                       

                      xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:comp="*">

                       

                       

                      <comp:POCPosteWithChart />

                      </

                       

                      mx:Application>

                       

                      all works fine.

                       

                      Is this the right way ? or  it must works on the same way running directly the canvass ?

                       

                      thanks,

                       

                      Fabio

                      • 8. Re: Problem in mx:Canvas click handler
                        Flex harUI Adobe Employee

                        The top tag of the application must be Application.  Otherwise you just have

                        a "component" and it must be used in an application, so yes, you are now

                        doing it the right way and that would explain the errors you got.

                        • 9. Re: Problem in mx:Canvas click handler
                          BhaskerChari Level 4

                          Hi fimperioli,

                           

                          Yes ofcourse this is the right approach you are using.....You cannot run directly the canvas since it is your custom component...they cannot be run as stand alone applications...you can run the files only which have the <mx:Application/> tag as the root tag.

                           

                          So all your custom components should be included in your application file the same way you used now...

                           

                          You can also include your other components within another compoenents..and so..

                           

                          Hope this will make the things clear...

                           

                           

                          If this post answers your question or helps, please mark it as such.

                           

                          Thanks,

                          Bhasker Chari

                          • 10. Re: Problem in mx:Canvas click handler
                            fimperioli Level 1

                            Hi Chari,

                             

                            and thanks for your support.

                             

                            Regards,

                             

                            Fabio