Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / Flash / General Flash Topics / July 2008



Tip: Looking for answers? Try searching our database.

Hit size issues within a MC

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Satrop-0 - 10 Jul 2008 10:38 GMT
Hi all! I have a small problem. I have a MC with this code.

This plays a small animation inside the MC.
    An thumbnail of a car that has a mask over the top that expands to show
the rest of the car. Now, the hit size of the MC starts off as just the
thumbnail (small) but when the expand happens the size of the hit area has also
expanded to the same size as the car (big). This does not work for me, not one
little bit, as I have other images in a row. As you can see I have code in
place so that the MC that is being rolled over is at the front (overlaping the
image below).
    In short, I need the hit size to stay small. How can I do this?? I am more
than happy to send the .fla to anyone that need's to see what I mean.

Thanks all!

onClipEvent (enterFrame) {
    if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
        this.nextFrame();
    } else {
        this.prevFrame();
    }
}
on (rollOver) {
    _root.x += 2;
    _root.img_01_Mc.swapDepths(_root.x);
}
Satrop-0 - 10 Jul 2008 16:53 GMT
So I'm trying to, now set the hit area to a different MC. With this code
attached to another MC>

on (rollOver) {
    img_01_Mc.hitArea = btn_01;
}

This code as you can see is, telling img_01_Mc that its new hit area is
btn_01, but! Its not have any effect.

This code is attached to the img_01_MC>

onClipEvent (enterFrame) {
    if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
        this.nextFrame();
    } else {
        this.prevFrame();
    }
}
on (rollOver) {
    _root.x += 2;
    _root.img_01_Mc.swapDepths(_root.x);
}

Can anyone help? Because I am stuck!

Thanks all
Satrop-0 - 11 Jul 2008 10:47 GMT
So I don't know if your like me but, I hate not knowing if a problem has been
solved or not, so for the benefit of everyone else having the same issue I
fixed the proble and I'm replying to myself with the fix.

To solve the problem of setting a hit state to a different MC this is what I
have done.

I have a movieClip with the ainmation start on the rollOver and play in
reverse on rollOut. Whilst at the same time have the image stay infront of the
mpvieClip to the left or right (the ainmation is a mask layer over a large
picture, expanding from a small square to show the whole image). The rollOver,
rollOut effect, and set that movieClip to rest on top was an easy one to set
with this code.

onClipEvent (enterFrame) {
    if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
        this.nextFrame();
    } else {
        this.prevFrame();
    }
}
on (rollOver) {
    _root.x += 2;
    _root.img_01_Mc.swapDepths(_root.x);
}

Great! But this is where my issue came into effect! The hit area size
incressed with the animation. Making the whole effect look rubbish. As you
would have to move all the way out of the movieClip to get to the next. So the
way around this is to creat a movieClip ontop of the "animated movieClip" and
set the "Alpha" to 0% and then attach this code.

onClipEvent (enterFrame) {
    if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
        _root.img_01_Mc.nextFrame();
    } else {
        _root.img_01_Mc.prevFrame();
    }
}
on (rollOver) {
    _root.x +=2;
    _root.img_01_Mc.swapDepths(_root.x);
}

Sorry this is so long, but I appreciate when people give a "lay-mans"
explanation for the "n00bz" out there.

So with that said, a break down of the code>

"if (this.hitTest(_root._x..."  
    "this." refers to: the movieClip with the Alpha set to 0%, to which the
code is attached.

    "hitTest" refers to: if the mouse pointer is on the movieClip then start
the animation "img_01_mc". Which is called into effect with
"_root.img_01_Mc.nextFrame();" this plays the animation forwards.

    "else {" refers to: if the mouse pointer is no longer over the movieClip
(with alpha 0%) then play the animation backwards by calling this part of the
code into effect "_root.img_01_Mc.prevFrame();", and the the animation begins
to play in reverse.

The last part of the code is simple.

on (rollOver) {
_root.x += 2;
_root.img_01_Mc.swapDepths(_root.x);
}

this just tells the movieClip "img_01_Mc" to sit ontop of other movieClips to
the left or right if the mouse is on the hit area.

All this said and done. It might be a little hard to follow without seeing
what I'm talking about. So if you want the .fla just ask and I will be more
than happy to send it to any one that would like it!

Happy "Flashing"

All the best,

Satrop
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.