Powered by Invision Power Board

 
    Reply to this topicStart new topicStart Poll

> -SOLVED-, Flash: While over button
Germany
TheSuperyoshi
Posted: Oct 16 2009, 11:05 AM
Quote Post


Play my game. No better idea what to write :P
[*]

Group Icon
Group: Members
Posts: 125
Member No.: 6377
Joined: 8-July 09

Status: (0d) [--]


What I try to archieve is to make a movie clip scroll while the mosue is over a button

CODE
on (rollOver) {
screenie_clip._x=screenie_clip._x-5
}


This code works, but ti just scrolls when entering - when staying in the button, the movie clip doesn't move a pixel.
Any help?

This post has been edited by TheSuperyoshi on Oct 17 2009, 06:00 AM


--------------------

user posted image ----- user posted image
I was drawn by: Me (aka. Ref) - fiDumppi
I drew: Segatendo (in Progress) - mirror
user posted image

PMEmail PosterUsers WebsiteICQMSN
Top
Unspecified
ChaosEmerl
Posted: Oct 16 2009, 11:19 AM
Quote Post


You are our master!!
[*][*]

Group Icon
Group: Members
Posts: 1419
Member No.: 2765
Joined: 5-October 06

Status: (0d) [--]


I'm not too sure but it looks to me like that would only move it -5 pixels once.

Wouldn't you need to put it in some kind of loop?

I'm not too familiar with Actionscript, but it's just an idea.


--------------------
PMEmail Poster
Top
Germany
TheSuperyoshi
Posted: Oct 16 2009, 11:21 AM
Quote Post


Play my game. No better idea what to write :P
[*]

Group Icon
Group: Members
Posts: 125
Member No.: 6377
Joined: 8-July 09

Status: (0d) [--]


Yeah, it moves once when you move in. What I want is a event like (mouseIsOver) or something which gets executed every frame when the mouse is over the button.


--------------------

user posted image ----- user posted image
I was drawn by: Me (aka. Ref) - fiDumppi
I drew: Segatendo (in Progress) - mirror
user posted image

PMEmail PosterUsers WebsiteICQMSN
Top
Unspecified
ChaosEmerl
Posted: Oct 16 2009, 11:23 AM
Quote Post


You are our master!!
[*][*]

Group Icon
Group: Members
Posts: 1419
Member No.: 2765
Joined: 5-October 06

Status: (0d) [--]


Would putting it in a while loop like this work?

while (rollOver) {
screenie_clip._x=screenie_clip._x-5
}


--------------------
PMEmail Poster
Top
Germany
TheSuperyoshi
Posted: Oct 16 2009, 11:31 AM
Quote Post


Play my game. No better idea what to write :P
[*]

Group Icon
Group: Members
Posts: 125
Member No.: 6377
Joined: 8-July 09

Status: (0d) [--]


QUOTE (ChaosEmerl @ Oct 16 2009, 05:23 PM)
Would putting it in a while loop like this work?

while (rollOver) {
screenie_clip._x=screenie_clip._x-5
}

Nope, didn't work.


--------------------

user posted image ----- user posted image
I was drawn by: Me (aka. Ref) - fiDumppi
I drew: Segatendo (in Progress) - mirror
user posted image

PMEmail PosterUsers WebsiteICQMSN
Top
Unspecified
ChaosEmerl
Posted: Oct 16 2009, 02:53 PM
Quote Post


You are our master!!
[*][*]

Group Icon
Group: Members
Posts: 1419
Member No.: 2765
Joined: 5-October 06

Status: (0d) [--]


Is there an action for when you roll the mouse off the object?

Because you could create a boolean variable called "scroll" and set it to true on(rollOver) then in a set it to false when you roll off the button.

Something like

on (rollOver) {
scroll=true
}

on (rollOff?) {
scroll=false
}

And then on the movie clip, you'd have the event be like

while (scroll) {
screenie_clip._x=screenie_clip._x-5
}

Or something like that.

If there's no way to do that, you could track the mouse's position yourself. And make it something like this (I don't know what the exact functions for the mouse coordinates are, so you'd have to figure that out yourself)

while (mouse_x >= button._x - 50 && mouse_x <= button._x + 50 && mouse_y >= button._y - 50 && mouse_y <= button._y + 50) {
screenie_clip._x=screenie_clip._x-5
}

This assumes your button is 100 x 100 pixels big. (Seeing if the mouse is within 50 pixels from all sides of the middle of it.) You'd have to adjust that accordingly.

And as for the &&s, I'm not sure if that's what flash uses as an AND. It might just be the word AND.

I might be able to help you more if I reinstalled my copy of flash and actually tried it.


--------------------
PMEmail Poster
Top
Germany
TheSuperyoshi
Posted: Oct 17 2009, 03:54 AM
Quote Post


Play my game. No better idea what to write :P
[*]

Group Icon
Group: Members
Posts: 125
Member No.: 6377
Joined: 8-July 09

Status: (0d) [--]


Nothing worked, sadly. I'll try doing it with a scroll bar, then.

EDIT: Works, so this thread can be closed now.
If you want a little script for scroll bars to move a movie clip, just PM me.

This post has been edited by TheSuperyoshi on Oct 17 2009, 04:59 AM


--------------------

user posted image ----- user posted image
I was drawn by: Me (aka. Ref) - fiDumppi
I drew: Segatendo (in Progress) - mirror
user posted image

PMEmail PosterUsers WebsiteICQMSN
Top
Finland
Hohoo
  Posted: Oct 17 2009, 05:55 AM
Quote Post


BAN AUTOTUNE
[*][*][*]

Group Icon
Group: Members
Posts: 1562
Member No.: 3062
Joined: 14-December 06

Status: (0d) [--]


There's no need to close any help thread just because the problem has been solved.


--------------------

user posted image

Reference

Mickeysoft Internet Explorer

MKE


cat /usr/share/icons/*/* > /dev/dsp
user posted image
NOW IS EXCITING COMING
Johto > Hoenn > Sevii > Sinnoh > Kanto
PMUsers Website
Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

  Topic Options Topic Options Reply to this topicStart new topicStart Poll

 




[ Script Execution time: 0.0415 ]   [ 14 queries used ]   [ GZIP Enabled ]   [ Server Load: 1.68 ]