A Flash Developer Resource Site

Page 1 of 2 12 LastLast
Results 1 to 20 of 25

Thread: scroller with hot spot

  1. #1
    Senior Member freshly's Avatar
    Join Date
    Dec 2003
    Location
    Toronto, Canada
    Posts
    439

    scroller with hot spot

    Hello to all,

    I have posted a source file that looks like this......




    you will see that there is a scroller loaded into the bottom part of the
    main movie, you will also see that the scroller scrolls no matter where the mouse is. I would like the scroller to work only when the mouse is over the bottom part of the movie, now I know that this a boolean action but I am not sure of how to write the script, please help, thanks!!

    Note: this is a flash 8 file

  2. #2
    Member
    Join Date
    Aug 2005
    Posts
    42
    Look into using Movieclip.hitTest() Method

    -- or --

    MovieClip.hitArea Property


    Using either will allow a "hit area" for your scrolling movie clip.

  3. #3
    Senior Member freshly's Avatar
    Join Date
    Dec 2003
    Location
    Toronto, Canada
    Posts
    439
    I understand what you are saying but I don't know how to write that script, if
    you could post an example of that I could probably apply it to my movie or work it into the scroller script, that would be great if you could

  4. #4
    Member
    Join Date
    Aug 2005
    Posts
    42

    fresh

    Create a movieClip the size of your scroll area

    the if statement checks to see if the mouse is within your "hit area"

    the scrollAction() will be your scroll action --

    Code:
    yourMovieClip.onEnterFrame = function() {
    	if (yourMovieClip.hitTest(_xmouse, _ymouse, true)) {
    		scrollAction();
    	}
    };

  5. #5
    Senior Member freshly's Avatar
    Join Date
    Dec 2003
    Location
    Toronto, Canada
    Posts
    439
    thanks man I really appreciate it, I will try it

  6. #6
    Senior Member freshly's Avatar
    Join Date
    Dec 2003
    Location
    Toronto, Canada
    Posts
    439
    Hey I have tried to apply what you posted but I can't get it to work
    so I have posted the new files with the work I have done, maybe you could look it over for me?

  7. #7
    Member
    Join Date
    Aug 2005
    Posts
    42
    using flash MX 2004 -- can't open these files

  8. #8
    Senior Member freshly's Avatar
    Join Date
    Dec 2003
    Location
    Toronto, Canada
    Posts
    439
    I have attached the files saved down

    Thanks again man!!

  9. #9
    Member
    Join Date
    Aug 2005
    Posts
    42
    ...these won't open either --

  10. #10
    Senior Member freshly's Avatar
    Join Date
    Dec 2003
    Location
    Toronto, Canada
    Posts
    439
    Anyone Please Any Idea's!!

  11. #11
    Senior Member freshly's Avatar
    Join Date
    Dec 2003
    Location
    Toronto, Canada
    Posts
    439
    Here I will post them again I didn't save them down properly!

  12. #12
    Member
    Join Date
    Aug 2005
    Posts
    42
    still no dice man...using Flash MX 2004. Error is "Unexpected File Format"

  13. #13
    Senior Member freshly's Avatar
    Join Date
    Dec 2003
    Location
    Toronto, Canada
    Posts
    439
    soory is that v6 or v7

  14. #14

  15. #15
    Senior Member freshly's Avatar
    Join Date
    Dec 2003
    Location
    Toronto, Canada
    Posts
    439
    Ok I have opened these files in Flash MX 2004 my self these should work

    please check the files attached

    thanks
    Last edited by freshly; 02-17-2010 at 06:38 PM.

  16. #16
    Member
    Join Date
    Aug 2005
    Posts
    42
    I apologise in advance for my half solution...but that is exactly what it is. Though it is currently working, I'm not quite sure it is working the way you'd like it to. For whatever reason, the the .swf was getting loaded, it wasn't working in your test.swf.

    so here's half your answer - -
    Attached Files Attached Files

  17. #17
    Senior Member freshly's Avatar
    Join Date
    Dec 2003
    Location
    Toronto, Canada
    Posts
    439
    Skillionaire you da man, thanks, works great!

  18. #18
    Senior Member freshly's Avatar
    Join Date
    Dec 2003
    Location
    Toronto, Canada
    Posts
    439


    I thought everything was great until I published it as a player 8 or 7 file.
    It doesn't work again, I think it has something to do with
    loading the swf into _level1, I guess flash 8 and 7 handle it different. Skillionaire I know you don't have flash 8
    but could you get it to work as player 7.

    I am so frustrated with this, and I have to tell you I really appreciate your help!!
    Last edited by freshly; 06-05-2006 at 04:23 PM.

  19. #19
    Senior Member freshly's Avatar
    Join Date
    Dec 2003
    Location
    Toronto, Canada
    Posts
    439
    Can anyone Help!

  20. #20
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    I think your VERY confused. PUBLISHING settings should have no bearing on this at all.

    And in the 'examples' there was no mention of loading it anywhere...so where is the loadMovieNum(); coming from? You are sorta correct, in that the loading IS you problem..but have nothing to do with FLASH..it has to do with the way you coded it.

    In the example...not only did you have depricated code (setProperty)..but _root was being used. _root is ONLY good (IMHO) to store a global VARIABLE accessable from anywhere & everything..or for testing purposes.. other than that NEVER use _root in your final projects...for just this reaosn that happened to you.

    When you load an external.swf or whatever into a target (emptyClip) or level... the _root of the 'loaded' document is NO LONGER the _root, but it is the _root (MAIN) timeline of the movie that called/loaded/holds the loaded 'document' (make sense?)

    So if you have a MAIN.swf that has an empty movieClip on stage with the instance name of 'containerClip' and a button.. and that button loaded an external.swf into the emptyClip on the stage like so:
    Code:
    on(press) {
        containerClip.loadMovie("external.swf");
    }
    whatever refernce of/to _root in the external.swf NOW refer to the MAIN.swf's timeline.

    SO anything in the external.swf you wanted to target or control you would need to path to it as such:
    Code:
     _root.containerClip.someClipName._rotation = 55;
    if you want to rotate soe clip in the externally loaded .swf


    that being said..that is most likely your problem...

    so try this;
    Code:
    if (this.hotspot.hitTest(_root._xmouse,_root._ymouse, true)) {
    	this.mouseX = _root._xmouse;
    	this.menuX = menu._x;
    	if (this.mouseX>280) {
    		diff = (this.mouseX-280)/15;
    	}
    	if (this.mouseX<220) {
    		diff = (220-this.mouseX)/15;
    	}
    	if (this.mouseX<=250 && this.menuX<=56) {
    		menu._x = _root.menuX+diff;
    		//setProperty("menu", _x, _root.menuX+diff);
    	}
    	if (this.mouseX>=250 && this.menuX>=-204) {
    		menu._x = this.menuX-diff;
    		//setProperty("menu", _x, _root.menuX-diff);
    	}
    	if (menu._x>=56) {
    		menu._x = 56;
    	} else if (menu._x<=-204) {
    		menu._x = -204;
    	}
    	gotoAndPlay(2);
    }

    using RELATIVE pathing instead of absolute is always best.

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