Solved

moving object smoothly by pressing button

Posted on 2003-11-16
6
240 Views
Last Modified: 2010-04-03
Hello!

I have a menu bar with three buttons and an object(movie clip) above them.
What I want is:
  1. by pressing the button the object to move and stay above the pressed button.
  2.when roll-over a button the object moves smoothly above it. Like tweening.

What I did was I change the _x coordinate but it goes very quickly.

Thanks in advance!
0
Comment
Question by:mihaylina
  • 3
  • 3
6 Comments
 
LVL 27

Accepted Solution

by:
negatyve earned 100 total points
ID: 9760429
0
 

Author Comment

by:mihaylina
ID: 9766026
Hello,

Thanks for sending me this solution. I still have a question: I can sort of gigure out your idea but I can't find where the following properties are defined: startx, endx, rames?

Thanks
0
 
LVL 27

Expert Comment

by:negatyve
ID: 9772577
this is the script assigned to the moving rectangle:

onClipEvent(load){
      this.startx = this.endx = this._x;
      this.frames = 5;
}
onClipEvent(enterFrame){
      // this is the decelerated motum formula
      this._x += (this.endx - this._x) / this.frames;
}

buttons change this variables with:

on(rollOver){
      this._parent.moving.endx = this._x;
}
on(rollOut){
      this._parent.moving.endx = this._parent.moving.startx;
}
on(release){
      this._parent.moving.endx = this._parent.moving.startx = this._x;
}
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:mihaylina
ID: 10000168
Hi,

Now I am trying to add a scroll bar down but it doesn't appear. When I create a new document everything is fine. But with the one with your code I cannot see the scroll bar. What is the problem? Thanks
0
 
LVL 27

Expert Comment

by:negatyve
ID: 10004637
What kind of scrollbar?
0
 

Author Comment

by:mihaylina
ID: 10008557
Sorry,
I found the problem.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now