A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: button goto not working with preloader!

  1. #1
    Member
    Join Date
    May 2006
    Posts
    39

    button goto not working with preloader!

    Hiya, I am building a small site for experience and have run across a bit of a problem. The main part of my site containes a small character that walks around following your mouse clicks (this works fine) I also have a few objects in the room that are buttons to link to other parts of the site. I dont want to go straight to the frame when the buttons are pressed, instead the character walks up to the object and then goes to the frame. This had been working fine until I added a preloader! now it will not work.

    the code behind the button is this.

    on(release){
    if (this.hitTest(_root._xmouse, _root._ymouse, true)){
    _global.link = "computer";
    }
    }

    which just assigns a location variable.
    this is then actioned in the code behind the character which is in a switch condition to ensure that the character has stopped moving

    switch(_global.link){
    case "off" :
    break;
    case "computer" :
    _global.link = "off";
    _root.gotoAndStop(50);
    break;
    }

    Im sure that it must be because of my _root.goto, does it now see the preloader scene as the root? I have also tried _parent and directing with .gotoAndStop("main", 50);
    but to no avail.

    any help would be appreciated.

    sillyfishyboy.

  2. #2
    Member
    Join Date
    May 2006
    Posts
    39

    another problem

    Well, I have managed to find a workaround for it, by setting another variable rather than doing a goto, I then used this variable to trigger the goto from the timeline, rather than the object. I know that there must be a better way, but it works!

    My latest problem isnt so much a problem but more a request for advice, The purpose of this site is as a portfolio to dispaly graphics and perhaps animations and so forth. At the moment I have only imported about 50 or so images, but obviously this is causing the file to be quite large. Usually I work with director, and so link to external files (thus saving load times), what is the best way I can deal with this in flash? I have thought about seperating my file into half a dozen smaller files, so that the part displaying 3d images is only loaded if the viewer wants to view 3d images. Although I dont really know how to load another swf from within an swf. but I am sure someone could help me with that. or perhaps if there is a way to link to external files. I know i can make an external library, but as far as I understand it this is more to allow multiple movies to use the same library. Also, would it help to create thumbnails as buttons rather than scaling the full image. (I did a bit of a test with this and it didnt seem to make much difference)

    Any help or advice appreciated.

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