3 Replies Latest reply on Oct 26, 2006 8:42 AM by leotemp

    progressBar complete event never occurs!

    leotemp Level 1
      OK i am including the event packages and am adding the event listener but it doesnt activate the listener function, I can watch the progress bar work but it doesnt trigger the function, If i put the complete="{LoadComplete}" event in the progressBar tag it works fine, whats the deal?

      I have tried:
      NameOfProgressBar.addEventListener("complete", loadComplete);
      And I have tried:
      NameOfProgressBar.addEventListener(Event.COMPLETE, loadComplete);

      Neither trigger the "loadComplete" function.. ARRRRGGGHH!
        • 1. Re: How to capture the complete event for a progress bar
          Nataliefay Level 1
          Hi,

          I'm sorry to bug you with a non-technical discussion, but I am a recruiter in San Diego. My client is in need of 3 Senior Flex Developers for their project. I have had an extremely rough time finding someone for this position. Would you be interested in this position, or do you know of anyone that might be? We do pay referral fees. This position may be open to telecommuting.

          Job Description:
          They are in the midst of a major re-architecting of their Corporate Management system utilizing many cutting edge technologies. As it relates to the position they are using Flex as their UI.

          This is either a contract, or a full-time position.

          Pay: Market Rate

          Thanks for your help!

          Natalie Fay
          Outsource Technical
          www.ostechnical.com
          nfay@ostechnical.com
          858.874.5637
          • 2. Re: How to capture the complete event for a progress bar
            rmarp Level 1
            Can you post your exact code? I suspect this is just a syntax issue.

            Ryan
            • 3. Re: How to capture the complete event for a progress bar
              leotemp Level 1
              OK, below is my code. There is allot of stuff going on that is dependant on data from an HTTPService, I can garuntee that works fine though as I can see the progress bar load the data and the image rolls to the new source when it completes, just no event listenere is triggered. While we are on the subject, I use an array to collect this value from my httpservice and I would really rather just pull it from the XMLlist but every time i tried to use e4x i couldnt find the data in the collection, if you feel up to helping me on that too I would be forever greatfull.

              CODE:

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

              <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" xmlns="*" creationComplete="{getMedia('home')}" viewSourceURL="srcview/index.html" width="100%" height="100%" backgroundGradientColors="[#808080, #000000]" layout="absolute">

              <mx:HTTPService id="xmlMediaList" url="xml.test.xml" method="GET"/>

              <mx:Script>
              <![CDATA[

              import mx.rpc.events.*
              import flash.events.*

              // PAGE INITIALIZE FUNCTIONIONALITY //
              // sends request for images to server //
              private var loadTrack:Number=0; //Tracks how many assets have been loaded//
              private var loadCount:Number; //Tracks total number of assets to load//
              private var arrayImages:Array; //Stores assets to load //
              private function getMedia(page:String):void {
              var params:Object= new Object;
              params.func= "loadImages";
              params.page= "home";
              // create listener for server returned result //
              xmlMediaList.addEventListener("result" , buildMediaArray);
              // send request to server //
              xmlMediaList.send(params);
              }
              private function buildMediaArray(event:ResultEvent):void {
              arrayImages= mx.utils.ArrayUtil.toArray(event.result.xml.image);
              loadCount=arrayImages[0].length;
              loadMedia();
              }

              private function loadMedia():void {
              if (loadTrack!=loadCount) {
              var obj:Object= this[arrayImages[0][loadTrack].id.toString()];
              var src:String= "img/flex/"+ arrayImages[0][loadTrack].name.toString();

              // THIS IS THE LINE HERE THAT DOESNT SEEM TO WORK!//
              progBar.addEventListener("complete", loadComplete);

              progBar.source= obj;
              progBar.visible= true;
              obj.load(src);
              debug.text= "loading file, please wait..."
              }
              }

              private function loadComplete():void {
              debug.text= "file loaded";
              progBar.visible= false;
              }
              ]]>
              </mx:script>


              <mx:Image scaleContent="true" maintainAspectRatio="false" id="imgBGGround" x="0" width="750" height="550" bottom="0"/>

              <mx:Label x="10" y="10" text="Label" id="debug" color="#ffffff"/>

              <mx:ProgressBar x="249" y="198" id="progBar" fontFamily="Arial" color="#ffffff" visible="false"/>


              </mx:Application>