dcsimg
A Flash Developer Resource Site

Results 1 to 18 of 18

Thread: MC rollovers

  1. #1
    Member
    Join Date
    Dec 2002
    Posts
    39

    MC rollovers

    Hello all,

    I was wondering if any one knows of a glitch in MX that doesn't allow you to call eventhandlers such as RollOvers and such once a MC has been used in a function. Because I got everything done for my movie except I can't get it to react once a rollover is performed. I can get the action to happen if I rollover another MC. But that just seems to be a unnecessary step. A fresh perspective on this would be greatly appreciated. Thanks Joey
    Attached Files Attached Files

  2. #2
    Realising Ideas philgoddard's Avatar
    Join Date
    Mar 2002
    Location
    Manchester, UK
    Posts
    227
    I have noticed similar problems with the use of Flash on Apple Macs but not PC's if this helps?

  3. #3
    Senior Member
    Join Date
    Aug 2002
    Location
    Dublin, Ireland
    Posts
    1,749
    It is just a coding/timing thing. There are two ways to fix it:
    1. the hard way, build in a timer to add the function once you know everything is there.
    2. the easy way, load into a blank holder.

    Here is the easy way:

    1. Delete the onload function from emptyMC
    2. Delete the actions from the button
    3. Replace the actions you have left with this:
    PHP Code:
    loadJPG = new loadVars();
    loadJPG.load("jpg.txt");
    loadJPG.onLoad = function() {
        
    emptyMC.createEmptyMovieClip("holder",1);
        
    emptyMC.holder.loadMovie(this.firstmc);
    };
    function 
    emptyMC_roll() {
        
    emptyMC._alpha 100;
    }
    function 
    emptyMC_rollout() {
        
    emptyMC._alpha 40;
    }
    MC1.onRollOver emptyMC_roll;
    MC1.onRollOut emptyMC_rollout;
    emptyMC.onRollOver emptyMC_roll;
    emptyMC.onRollOut emptyMC_rollout

  4. #4
    Senior Member
    Join Date
    Aug 2002
    Location
    Dublin, Ireland
    Posts
    1,749

    Although...

    You want to be careful loading files from different domains like that. Flash doesn't like it for security reasons.

  5. #5
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    here
    - The right of the People to create Flash movies shall not be infringed. -
    | www.Flashscript.biz | Flashscript Biz Classes/Components |

  6. #6
    Senior Member
    Join Date
    Aug 2002
    Location
    Dublin, Ireland
    Posts
    1,749
    Am I missing something?
    It looks like you have edited the text file to show your movie instead of a JPG, which is of course impressive. But did you change anything else?

  7. #7
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    I usually don't like to put event handlers for buttons in the button. I prefer to use this syntax on the main timeline:

    myButton.onRelease=function(){
    function here
    }
    That lets you control the paths much easier. JPG should be the same by the way. I just had this little movie available.
    - The right of the People to create Flash movies shall not be infringed. -
    | www.Flashscript.biz | Flashscript Biz Classes/Components |

  8. #8
    Senior Member
    Join Date
    Aug 2002
    Location
    Dublin, Ireland
    Posts
    1,749
    Perhaps you should reread my first response.

  9. #9
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    I think you have to write in this way:

    function_emptyMC_roll()_{
    emptyMC.onRollOver=function(){
    ____emptyMC._alpha_=_100;
    }
    }
    emptyMC_roll();

    this would work but is not necessary.
    - The right of the People to create Flash movies shall not be infringed. -
    | www.Flashscript.biz | Flashscript Biz Classes/Components |

  10. #10
    Senior Member
    Join Date
    Aug 2002
    Location
    Dublin, Ireland
    Posts
    1,749
    Not to be picky, the solution I put up works. That is why I put it up.

    Not to be judgmental, but this makes it a little superior to your zip that doesn't.

    I am sorry that you don't understand the coding technique, but that is not my problem.

  11. #11
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    I haven't see your way of coding before but I am always happy if I can learn something new. I haven't tested your code so I apologize if I said it may not work.
    - The right of the People to create Flash movies shall not be infringed. -
    | www.Flashscript.biz | Flashscript Biz Classes/Components |

  12. #12
    Member
    Join Date
    Dec 2002
    Posts
    39
    WOW! I work on this for hours trying to figure out what I am doing wrong, give up and post before I go to bed. I wake and I have 10 responses. Very impressive. Thank you both for your help. I took something away from both of your suggestions, however I went with AlsoGaiusCoffey code it worked great. I do have 2 other questions for you guys or anyone else who can answer. I have about 40 thumbnails that I want to use with this am I going to be able to reuse the functions without having to recall new LoadVars(); each time. Also mentioned earlier about cross domain being unsafe. I would prefer not to access the files from cross domain. I just used that pic as an example I have tried to set the var firstmc in the jpg.txt to the direct path on my machine, but I just keep getting errors.
    C:\Inetpub\wwwroot\someimg.jpg //doesnt work.
    http://www.someserver.com/someimg.jpg //does

    any suggestions?

  13. #13
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    if you have one function loadVars and different textfiles you can make a class definition of a movieclip.

    MovieClip.prototype.loadText=function(myText){
    this.onRelease=function(){
    loadVars function here (myText)
    }
    }

    clip1.loadText("text1);

    This gives you a rough idea.

    But I wouldn't trust what I said just now, because I don't know the coding technique
    - The right of the People to create Flash movies shall not be infringed. -
    | www.Flashscript.biz | Flashscript Biz Classes/Components |

  14. #14
    Member
    Join Date
    Dec 2002
    Posts
    39
    Thanks for the suggestion. That will definitely get me started. How about the second part with the paths? any suggestions?
    Thanks Joey

  15. #15
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    Just put the pics in the same domain. As you saw your script worked fine even with a movie. Why do you want to use crossdomain loading?
    - The right of the People to create Flash movies shall not be infringed. -
    | www.Flashscript.biz | Flashscript Biz Classes/Components |

  16. #16
    Member
    Join Date
    Dec 2002
    Posts
    39
    Thats my point, I don't want to use crossdomain loading. I want to be able to call pics from a file on my machine just as you did with the movie you sent back. The problem is it won't regonize more than one. If you leave the file like you did it works just fine, but I get errors if I try to call more than one pic, like this:
    Error opening URL "file:///C|/Inetpub/wwwroot/somefile/pic1.jpg

    "
    firstmc=pic1.jpg
    &secondmc=pic2.jpg
    &thirdmc=pic3.jpg

    I need to be able to call more than one, but if I leave it like you it works fine:
    firstmc=pic1.jpg

    The only way I have been able to make it work is using crossdomain, but like I said before this is not how I want to do it.

    Thanks Joey

  17. #17
    Member
    Join Date
    Dec 2002
    Posts
    39
    Ok figured it out. Flash doesn't like whitespace for whatever reason, so when I was placing each mc in the .txt file on a newline it was having a seizure. I don't know why this doesn't happen with other files I have used for variables of text, but it doesn't like it for addresses to file. I just placed every variable like so:
    a=pic1.jpg&b=pic2.jpg etc and it works great. Thanks again for all the help I got.
    Joey

  18. #18
    Senior Member
    Join Date
    Aug 2002
    Location
    Dublin, Ireland
    Posts
    1,749
    White space is a character in itself - as is tab, carriage return etc. Flash's behaviour is entirely correct. Try using a filename with a line feed in it and you will see what I mean!

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