Flash Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignFlash Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 3rd, 2003, 11:01 AM
Chanyom Chanyom is offline
Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Location: Missouri
Posts: 31 Chanyom User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to Chanyom
Question A Simply ActionScript Question

Hello, I am pretty new to using action script, and I am hoping that someone here can give me a hand by explaining what I have to do to animate (tween) certain property changes. For example: I have a square MC called boxOne, at a certain frame i wish to increase its width and height, which I did like this:

PHP Code:
 boxOne.onEnterFrame = function() {
    
boxOne._width 200;
    
boxOne._height 100;
}; 

I get the size that I want, but it does so instantly (in quantum step), but I wish to make it grow progressively (like a tween). What would i need to add/change to this script to acheive this?

Yes, I know I can get the same result by shape tweening in the timeline, but I am trying to learn how to manipulate things such as dimensions, alphas, colours, x/y co ordinates, etc...and do so by tweening.

Much thanks in advance to all who reply.
Mike

Reply With Quote
  #2  
Old April 4th, 2003, 12:29 AM
JCMerlin JCMerlin is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 126 JCMerlin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 14 m 29 sec
Reputation Power: 6
When you use onEnterFrame whatever is in that function is going to be called one time for every fps. If you want something toi gradually get larger use something like...

PHP Code:
 boxOne.onEnterFrame= function(){
to grow
   this
._width+=.5;
   
this._height+=.5;
 
to fade  
  this
._alpha-=1;



you can just play around with that.

Reply With Quote
  #3  
Old April 4th, 2003, 12:30 AM
JCMerlin JCMerlin is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 126 JCMerlin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 14 m 29 sec
Reputation Power: 6
Edited

Reply With Quote
  #4  
Old April 4th, 2003, 12:30 AM
JCMerlin JCMerlin is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 126 JCMerlin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 14 m 29 sec
Reputation Power: 6
Delete these last 2, it posted the same message 3 times for some reason.

Reply With Quote
  #5  
Old January 28th, 2004, 12:33 PM
lapidus lapidus is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: philly
Posts: 21 lapidus User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to lapidus Send a message via Yahoo to lapidus
On the same vein of motion tweening with aciton script

Ok, as mentioned in my previous posts, horribly new to action scripting(picked up the book yesterday), I think i've done pretty well, by creating the following

My main layer contains the following actionscript functions:

size=1;
function buttonincrease(butpoint, butpoint2)
{
butpoint._width+=size;
butpoint._x-=(size / 2);
butpoint._height+=size;
}
function buttondecrease(butpoint, butpoint2)
{
butpoint._width-=size;
butpoint._x+=(size/2);
butpoint._height-=size;
}

I have two buttons on that layer that contain the following:

on (rollOver) {
_root.but1.swapDepths(_root.but2);
_root.but1.onEnterFrame = function()
{
_root.buttonincrease(_root.but1);
}
}

//on (rollOut) {
// _root.but2.swapDepths(_root.but1);
// x=0;
// while (++x<20)
// {
// _root.buttondecrease(_root.but1, _root.but2);
// }
// }

now everything works, except, that I want the button to expand gradualy, like a motion tween as asked in the earlier part of this thread. The answer that was given was specific to the onEnterFrame handler. As you can see I implemented the onEnterFrame function and it works, it increases regularly, but it dosen't stop it just keeps increasing, and increasing, and increasing,

I've looked around in this stupid book that I have, which by the way makes no mention of the _x and the _y properties, all it says is that flash objects inherintly have co-oridinate handlers, but dosen't tell you what they are! how cheap! It took me 2 hours to find the _x and _y, I've searched for the onEnterFrame to try and better understand it's functionality, and why it won't stop, and have gotten no where. I am attaching my fla, to those that can help, i appreciate it, even if you don't know the answer, but can think of some key words that I can google myself, that would be appreciated also, I don't mind doing the leg work as long as someone puts me on the right track. Oh also, any suggestions as to reducing code size will help, i know that i can use a few recursive functions in there, but i'm not 100% sure how to implement them.

Thank you for any help that you can offer.
Attached Files
File Type: zip movie.zip (3.3 KB, 193 views)

Last edited by lapidus : January 28th, 2004 at 01:27 PM.

Reply With Quote
  #6  
Old January 28th, 2004, 04:22 PM
Tann San Tann San is offline
Gotta get to the next screen..
Click here for more information.
 
Join Date: Nov 2003
Location: Legion of Dynamic Discord
Posts: 4,566 Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)  Folding Points: 7835 Folding Title: Novice Folder
Time spent in forums: 3 Weeks 2 h 24 m 15 sec
Reputation Power: 518
Facebook MySpace
Hi,
Code:
function buttonincrease(butpoint, butpoint2)
   {
      // I used 20 due to your later "while" statement..20=maxsize here
      if(butpoint._width < 20)
         {
            butpoint._width+=size;
            butpoint._x-=(size / 2); 
            butpoint._height+=size;
         }
   }

function buttondecrease(butpoint, butpoint2)
   {
      // You should change 0 to be whatever the minimum size should be
      if(butpoint._width>0)
         {
            butpoint._width-=size;
            butpoint._x+=(size/2);
            butpoint._height-=size;
         }
   }
__________________
-Tann

-Vote for your favorite ActionScript editor here.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignFlash Help > A Simply ActionScript Question


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway