dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: error #1010 functions stops working halfway through

  1. #1
    Junior Member
    Join Date
    Oct 2010
    Posts
    2

    error #1010 functions stops working halfway through

    I made an interactive atlas of health facilities. Each facility is displayed with a symbol on the map. when the user rolls over the symbol it magnifies it by 2. when the user clicks on the symbol is remains magnified and information about that facility pops up. There are two functions used for the magnification (zoomIn) and zoomOut as follows.

    function zoomIn(evt) {
    //trace(evt.target.instanceName);
    //this.nurseArray[53].scaleX=3;
    this[whichDot+"Array"][evt.target.instanceName.slice(5,evt.target.instanc eName.length)].scaleX=2;
    this[whichDot+"Array"][evt.target.instanceName.slice(5,evt.target.instanc eName.length)].scaleY=2;
    }

    function zoomOut(evt) {
    this[whichDot+"Array"][evt.target.instanceName.slice(5,evt.target.instanc eName.length)].scaleX=1;
    this[whichDot+"Array"][evt.target.instanceName.slice(5,evt.target.instanc eName.length)].scaleY=1;
    }


    they work great except for when the user clicks a new tab in the Atals (which is actually a movie clip containing the information of the tab) until which the zoom functions stop working and I get an error message about a term being undefined (zoomIn and zoomOut)

    the zoom functions are defined on the mainTimeline and work great, i just don't understand why they stop working on the movie clips?

    any insight into this problem would be greatly appreciated.

    thanks,
    K

  2. #2
    Senior Member Computer Dork's Avatar
    Join Date
    Mar 2001
    Location
    St. Louis
    Posts
    1,026
    are your rollover/rollout functions tripping over each other? You should set up one function that controls zoom in/out, call it every time you roll over another button, and send it the target button name. Do a for loop and set every other button's zoom back to 1 except the target button.

  3. #3
    Junior Member
    Join Date
    Oct 2010
    Posts
    2
    I am not sure they are tripping over each other, I think they just get stuck when the movie clip changes. the symbols are all dynamic, which are linked with an xml file. Some one else suggested re-assigning the listerner when the we re-draw the facilities, but I am not sure what that means. I am still very new to AS.

    those zoom functions are on a "functions" layer on the main timeline and the following xml loading script is also on the main timeline under an "xml loading layer"

    this is how/where the zoom functions are called up:

    function LoadHospXML(e:Event):void {
    hospData=new XML(e.target.data);
    //trace(hospData);

    //trace(hospData.facility.length());
    for (i=0; i<this.hospData.facility.length(); i++) {
    this.hosp_mc = new dot();

    this.hosp_mc.instanceName="dot_h"+i;//update the instance name
    this.hosp_mc.addEventListener(MouseEvent.CLICK, idDot);//Add a listener for when the user clicks on a dot
    this.hosp_mc.addEventListener(MouseEvent.MOUSE_OVE R, zoomIn);
    this.hosp_mc.addEventListener(MouseEvent.MOUSE_OUT , zoomOut);

    //set the X & Y in screen/movieClip coordinates
    //this.hosp_mc.x=convertX(this.hospData.facility[i].long);
    //this.hosp_mc.y=convertY(this.hospData.facility[i].lat);
    //trace(this.hosp_mc.x);
    this.hospArray[i]=this.hosp_mc;//Add the MC to the array
    }

    }


    that is the only time the zoom functions are called. how can i connect them to the nested movie clips with out getting the undefined properties error?

    i tried what you suggested about the combining the zooms but then they lose their rollover states and you have to actually click them to make them zoom. I am not sure about how to make the loop though. Someone else helped write this code (the parts I dont understand)

    You can see the application here to get a better idea about what i am talking about:
    http://health.geo.msu.edu/atlas.html


    thanks for the help!

    -k

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center