dcsimg
A Flash Developer Resource Site

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

Thread: rollover fades

  1. #1
    Junior Member
    Join Date
    Apr 2005
    Location
    santa barbara
    Posts
    13

    rollover fades

    I'm trying to find a tutorial that will create a fade back effect for a rollover. There are so many tutorials to sift through, I don't know how long it will take to find it on my own. So can someone help me?

    Basically there are 5 color images of people on a page. When the mouse rolls over one image, the image's name/title should appear and the other 4 people images should fade back (to grey if possible, but not necessary). And when the mouse rolls off, the images should go back to normal. This should work for all 5 images. It sounds like a movie is needed for each rollover, but I can't quite pin it down.

    Help!
    Last edited by CoolMama; 04-01-2005 at 11:29 PM.

  2. #2
    Senior Member hum's Avatar
    Join Date
    Sep 2003
    Location
    CloudCuckooland
    Posts
    1,714
    Hi
    Here ya go....this should help to show you a way....actions are on the timeline

  3. #3
    Junior Member
    Join Date
    Apr 2005
    Location
    santa barbara
    Posts
    13
    Thank you. But i'm not sure i understand this one. It looks like when you roll over a square it fades and then goes back to normal on mouse out.

    I'm looking for a rollover where the square stays the same and all the other squares would fade back...then they return to normal on mouse out.

  4. #4
    Senior Member
    Join Date
    Feb 2005
    Posts
    173
    Hi CoolMama!!

    Here is your solution. I think this fla will make ur problem a bit easier. Try this out. It is done in Flash MX. This will make u get the idea and I hope u can do it much easier.


    Kallol
    Last edited by kallol_flashkit; 03-31-2008 at 04:10 PM.

  5. #5
    Senior Member hum's Avatar
    Join Date
    Sep 2003
    Location
    CloudCuckooland
    Posts
    1,714
    I'm looking for a rollover where the square stays the same and all the other squares would fade back...then they return to normal on mouse out.

    here is an update of previous fla.

  6. #6
    Junior Member
    Join Date
    Apr 2005
    Location
    santa barbara
    Posts
    13
    hey thanks hum!

    I realized later that i could have probably figured this out on my own by modifying your original code. But since you were nice enough to do the work...all the better.

    Now I just have to turn the individual images into buttons so that they go to a new scene when clicked. but I think that's easy enough. You just use activated button instances instead of graphic instances for the images used in the movie clip...right? I'll find out soon enough.

    And thanks to you too Kallol for your help in this!
    Last edited by CoolMama; 04-03-2005 at 01:34 PM.

  7. #7
    Senior Member hum's Avatar
    Join Date
    Sep 2003
    Location
    CloudCuckooland
    Posts
    1,714
    Hi
    You don't necessarily need to use buttons...you can apply the code to movieclips...example
    code:
    on(press){
    gotoAndStop("yourFrameLabel")
    }


  8. #8
    Junior Member
    Join Date
    Apr 2005
    Location
    santa barbara
    Posts
    13
    Wow, this all turned out to be a lot simpler than I originally had it in my head. Glad I asked.

    Thanks!

  9. #9
    Junior Member
    Join Date
    Apr 2005
    Location
    santa barbara
    Posts
    13
    Ok, I spoke to soon. I finally had an opportunity to implement this after being diverted to another project. Everything went fine until I tried to make the On(press) code work.

    The code is like this:
    rick.onRollOver = function() {
    ricktitle = "JOE, Sports Enthusiast";
    diannetitle = " ";
    bobtitle = " ";
    marcustitle = " ";
    saratitle = " ";
    this._alpha = 100;
    dianne._alpha = 30;
    bob._alpha = 30;
    marcus._alpha = 30;
    sara._alpha = 30;
    };
    rick.onRollOut = function() {
    ricktitle = " ";
    this._alpha = 100;
    dianne._alpha = 100;
    bob._alpha = 100;
    marcus._alpha = 100;
    sara._alpha = 100;
    };
    rick.on(press) {
    gotoAndPlay("rick", 1);
    };


    The error is like this:
    **Error** Scene=whosubscribe, layer=subscriber movie, frame=81:Line 21: Expected a field name after '.' operator.
    rick.on(press) {

    Total ActionScript Errors: 1 Reported Errors: 1


    Why is this not working? I'm trying to get each instance to go to a different scene when pressed.

  10. #10
    Banned NTD's Avatar
    Join Date
    Feb 2004
    Posts
    3,438
    Hi,

    You have object code mixed in with frame code....

    code:

    rick.on(press) {
    gotoAndPlay("rick", 1);
    }



    try.....
    code:

    rick.onPress=function(){
    _root.gotoAndPlay("frameLabel")
    }


  11. #11
    Junior Member
    Join Date
    Apr 2005
    Location
    santa barbara
    Posts
    13
    Well, there's no error message, but it's still not jumping to the new scene: ("rick", 1). Does it need special code to indicate jumping to a different scene, or will it only jump within the same scene?

    rick.onPress=function(){
    _root.gotoAndPlay("rick", 1)
    }

  12. #12
    Banned NTD's Avatar
    Join Date
    Feb 2004
    Posts
    3,438
    Hi,

    Put a frame label on the first frame of the scene you want to go to and target the frame label with the gotoAndPlay method...

    code:

    rick.onPress=function(){
    _root.gotoAndPlay("frameLabel")
    }


  13. #13
    Junior Member
    Join Date
    Apr 2005
    Location
    santa barbara
    Posts
    13
    OK, we have a final product. Yea!!

    But there's an annoying little glitch that I'm not sure if anything can be done about.

    If you go to http://www.newspress.com/_onlinetour_staging/

    you'll see the movie before we release it. Click through the tour a bit and when you see WHO SHOULD SUBSCRIBE at the top, click on it.

    The rollovers work. The button effects work. But when you click on BACK from the person's biography, which takes you back to the line of 5 people, you'll notice that the name of the person you rolled over is still visible when the line of people show up again. Almost like it forgot to permanently turn off when you clicked the button. It doesn't look like this code should cause it to happen.

    Any ideas?

    We're almost home, baby!!!

  14. #14
    Banned NTD's Avatar
    Join Date
    Feb 2004
    Posts
    3,438
    Hi,

    Very nice design. The back button could set the textfield to empty, just code the textfield to ""..from that button event...
    code:

    _root.pathToButton.backButtonName.onRelease=functi on(){
    //do the other stuff
    _root.mcName.textFieldName.text="";
    }


  15. #15
    Junior Member
    Join Date
    Apr 2005
    Location
    santa barbara
    Posts
    13
    Thanks a lot for the praise and your continued help.

    I know it's late and I'm just a novice programmer, but I've tried different variations to make this work. No luck.

    The back button is labelled "backbutton" and the mc that it refers back to is "rick". But I'm clearly missing something.

    BUTTON ACTION CODE
    _root.pathToButton.backbutton.onRelease=function() {
    gotoAndPlay("startpeople");
    _root.rick.ricktitle.text="";
    }


    ERROR MESSSAGE
    Scene=whosubscribe, Layer=back button, Frame=96: Line 1: Statement must appear within on handler
    _root.pathToButton.backbutton.onRelease=function() {



  16. #16
    Banned NTD's Avatar
    Join Date
    Feb 2004
    Posts
    3,438
    Hi,

    That is frame code and was meant as a demo. The "pathToButton" part should be changed to the actual path to the button. If you know the path to the textfield in question, you can use object code directly on the button with...

    code:

    on(release){
    //do the other stuff
    //if this is the path to the textfield...
    _root.rick.ricktitle.text="";
    }


  17. #17
    Junior Member
    Join Date
    Apr 2005
    Location
    santa barbara
    Posts
    13
    path? these things have paths? Ok, now I'm really confused. do you mean I just have to state the scene they are located in, the frame label they are located in and the name of the instance?

    _root.scene.framelabel.buttoninstancename
    _root.scene.framelabel.mc.texttitle

    everything is in the same scene. i chose not to create separate ones to make it easier. the frames where the back button and the RICK instance reside are not labelled. do they need to be?

    this is driving me nuts! now there are no error messages, but we're back to the title still being there when we click back to the beginning. Obviously I need this spelled out for me if it's ever going to get finished.

    on the button INSTANCE the attached code is:
    Code:
    on (release) {
    	gotoAndPlay("startpeople");
    }
    on the button FRAME the attached code is:
    Code:
    _root.whosubscribe.backbutton.onRelease=function(){
    	gotoAndPlay("startpeople");
    _root.rick.ricktitle.text="";
    }

  18. #18
    Banned NTD's Avatar
    Join Date
    Feb 2004
    Posts
    3,438
    Hi,

    What I meant by "path" is the actual path to the button. For example, a button on the main timeline of the movie would have a path of....

    _root.myButton...

    The path to a button inside a movieclip.....

    _root.myMovieClipName.myButton......

    The path to a button inside a movieclip that resides inside another movieclip....

    _root.firstMC.secondMC.myButton....

    The path only references where the object is located in your movie, not an internet web path.

    In my opinion, using multiple scenes is a bad practice. For ease of editing and a few other reasons, keeping content in a single scene is more efficient than using multiple scenes.

    Now, for the button code. If you prefer object code and you placed a frame label on the frame you want to send the playhead to, this will work.....

    code:

    on(release){
    _root.gotoAndPlay("startpeople");
    _root.rick.ricktitle.text="";
    }



    Now, if the "startpeople" frame is inside a movieclip and not on the main timeline, you need to account for the movieclip name in the path...

    code:

    on(release){
    _root.mcHolderName.gotoAndPlay("startpeople");
    _root.rick.ricktitle.text="";
    }



    hope it helps
    NTD

  19. #19
    Junior Member
    Join Date
    Apr 2005
    Location
    santa barbara
    Posts
    13
    Ok, i understand this better, i think.

    So I placed the code into the button instance as such, since everything is in the same scene, and therefore at the root level...
    Code:
    on(release){
    _root.gotoAndPlay("startpeople");
    _root.ricktitle.text=" ";
    }
    no errors. but still the title is there on return.

    i think it still can't find "ricktitle". "ricktitle" (along with the rest of that code) is located in a frame labelled "startpeople" (frame 81). The back button is located in an unlabelled frame (frame 96). so how does this code find "ricktitle" when it jumps back to "satrtpeople"? is it supposed to go to the "startpeople" frame and search through the code in it for "ricktitle" so that it can re-set it as blank?

    i know you're having so much fun with this.

  20. #20
    Banned NTD's Avatar
    Join Date
    Feb 2004
    Posts
    3,438
    Hi,

    I dont mind helping. It's just I am doing it all from imagination. I have not seen the file or how you have it set up. Flash allows for many different ways to accomplish the same task. First off, make sure the path your using to the textfield is correct. In the actions panel, select the target icon and find the textfield name in the list of objects. That will give you the correct path to the textfield. If the textfield name is not in the list of objects, it means it resides inside of a movieclip with no instance name. If a textfield is inside a movieclip with no instance name, flash doesn't know how to find it. Another option would be to put the textfield.text="" on the actual frame where the textfield resides. Every time the playhead is sent to that frame, flash will update itself with the code that is on the frame....

    Frame where the textfield resides....
    //make sure the path is correct...
    _root.ricktitle.text="";

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