5 Replies Latest reply on Feb 7, 2007 2:11 PM by breez11

    ease function not  triggered, trace triggered

    breez11 Level 1
      Here is my code Everything loads and I get the traces Hey, Buddy when I execute my code but doEase() does not trigger. If you give me an email I will be glad to send a zip of all the test files.


        • 1. Re: ease function not  triggered, trace triggered
          Level 7
          Hi!

          You are calling doEase as if doEase exists inside some MC you've just
          created with targetpath container_mc.widget1_mc. If you do a trace of that
          function before you call it, you will see that there is no doEase function
          defined in there:
          trace(container_mc.widget1_mc.doEase);

          If you change your call to something like this, then I think it should work:
          doEase(container_mc.widget1_mc);

          /Jensen/


          "breez11" <webforumsuser@macromedia.com> wrote in message
          news:epu3l3$ne1$1@forums.macromedia.com...
          > Here is my code Everything loads and I get the traces Hey, Buddy when I
          > execute my code but doEase() does not trigger. If you give me an email I
          > will
          > be glad to send a zip of all the test files.
          >
          >
          >
          >
          > this.createEmptyMovieClip("container_mc", this.getNextHighestDepth());
          > Movieclip.prototype.oldLoadMovie = Movieclip.prototype.loadMovie;
          > Movieclip.prototype.loadMovie = function(url, vars) {
          > if (this.onData != undefined && this.onData != null) {
          > this._parent.createEmptyMovieClip("__fixEvents", 7777);
          > this._parent.__fixEvents.theTarget = this;
          > this._parent.__fixEvents.onData = this.onData;
          > if (this.onLoad != undefined && this.onLoad != null) {
          > this._parent.__fixEvents.onLoad = this.onLoad;
          > }
          > this._parent.__fixEvents.onEnterFrame = function() {
          > this.oldv = this.v;
          > this.v = this.theTarget.getBytesLoaded();
          > if (this.v != this.oldv) {
          > this.onData.call(this.theTarget);
          > }
          > if (this.v == this.theTarget.getBytesTotal()) {
          > this.theTarget.onData = this.onData;
          > if (this.onLoad != undefined) {
          > this.theTarget.onLoad = this.onLoad;
          > }
          > this.onLoad.call(this.theTarget);
          > this.removeMovieClip();
          > }
          > };
          > }
          > this.oldLoadMovie(url, vars);
          > };
          > /////////////////////////////
          > var easing = 0.2;
          > var targX = -10;
          > var targY = 250;
          > /////////////////////////////
          > namesArray = new Array("bg", "widget1", "widget2", "widget3", "MainLogo",
          > "MainMessage");
          > locationsArray = new Array([0, 0], [-500, 250], [275, 225], [445, 250],
          > [530,
          > 105], [410, 23]);
          > for (var i = 0; i<namesArray.length; i++) {
          > //create a clip on the root using a reference
          > container_mc.createEmptyMovieClip(namesArray +"_mc", i);
          > container_mc[namesArray
          +"_mc"]._x = locationsArray [0];
          > container_mc[namesArray
          +"_mc"]._y = locationsArray [1];
          > container_mc[namesArray
          +"_mc"].onLoad = function(){
          > trace ("Buddy");
          > container_mc.widget1_mc.doEase();
          > }
          > container_mc[namesArray +"_mc"].onData = function(){
          > trace ("Hey");
          >
          > }
          > if (i == 0) {
          >
          > container_mc[namesArray
          +"_mc"].loadMovie("images/"+namesArray +".jpg");
          > } else {
          >
          > container_mc[namesArray
          +"_mc"].loadMovie("images/"+namesArray +".swf");
          > }
          > }
          > //////////////////////////////
          > function doEase(target) {
          > target.onEnterFrame = ease;
          > function ease() {
          > var dx = targX-this._x;
          > var dy = targY-this._y;
          > if (Math.abs(dx)<=1) {
          > this._x = targX;
          > this._y = targY;
          > delete this.onEnterFrame;
          > trace("done");
          > } else {
          > var vx = dx*easing;
          > var vy = dy*easing;
          > this._x += vx;
          > this._y += vy;
          > }
          > }
          > }
          > //////////////////////////////
          >
          > //////////////////////////////
          > var myXML_xml = new XML();
          > myXML_xml.ignoreWhite = true;
          > myXML_xml.onLoad = myFunction;
          > myXML_xml.load("xml/links.xml");
          > function myFunction() {
          > for (i=1; i<=4; i++) {
          > _root["link"+i] = myXML_xml.firstChild.childNodes[i-1];
          > //trace(_root["link"+i].firstChild);
          > container_mc[namesArray
          +"_mc"].onPress = function() {
          > getURL(_root["link"+this.id].firstChild, "_parent");
          > };
          > }
          > }
          > ///////////////////////////////
          >


          • 2. Re: ease function not  triggered, trace triggered
            Peter Lorent Level 2
            I send you the .fla I was using (version 8) on your request. If you have the upgrade to 8 your problem is solved. Otherwise, well let us know.
            • 3. Re: ease function not  triggered, trace triggered
              Peter Lorent Level 2
              Jensen: no that won't work because he still isn't waiting for the jpg/swf's to load.
              • 4. Re: ease function not  triggered, trace triggered
                Peter Lorent Level 2
                The whole principle of preloading in MX can be confusing. That's why they introduced MovieClipLoader in MX2004.
                Well, if you want that code to run in MX you just need a simple function to preload the data and THEN call a function to perform an action on the fully loaded clip. Try attached code.

                • 5. Re: ease function not  triggered, trace triggered
                  breez11 Level 1
                  Freakin Awesome. Thanks alot. Now I have another issue. I need targx & targy to be different values for nameArray items 1-3.

                  here is the updated code