How to create method with functions ?

This is a discussion on "How to create method with functions ?" within the Flash & Multimedia Forum section. This forum, and the thread "How to create method with functions ? are both part of the Design Your Website category.



Go Back   Webforumz.com > Main Forums > Design Your Website > Flash & Multimedia Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Oct 13th, 2007, 18:54
marSoul's Avatar
Moderator
Join Date: Sep 2007
Location: Tehran - Iran
Age: 28
Posts: 405
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 4 Posts
Send a message via MSN to marSoul Send a message via Yahoo to marSoul
How to create method with functions ?

I want to know how can I create a method in actionscript with function and add it to a button ?
__________________
Designing For Communicating
Website : http://www.datisdesign.com
Weblog : http://blog.datisdesign.com

Last Blog Entry: Throughout IRAN (Dec 10th, 2007)
Reply With Quote

  #2 (permalink)  
Old Oct 13th, 2007, 19:35
alexgeek's Avatar
Administrator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,769
Blog Entries: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alexgeek
Re: How to create method with functions ?

I think you need to be more specific.
Plus a method and a function are literally the same thing unless were are talking about object orientated programming.
What do you want the button to do?
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Reply With Quote
  #3 (permalink)  
Old Oct 13th, 2007, 19:37
marSoul's Avatar
Moderator
Join Date: Sep 2007
Location: Tehran - Iran
Age: 28
Posts: 405
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 4 Posts
Send a message via MSN to marSoul Send a message via Yahoo to marSoul
Re: How to create method with functions ?

for example create a function that rotate a box 15 degree, and assign it to the button
__________________
Designing For Communicating
Website : http://www.datisdesign.com
Weblog : http://blog.datisdesign.com

Last Blog Entry: Throughout IRAN (Dec 10th, 2007)
Reply With Quote
  #4 (permalink)  
Old Oct 13th, 2007, 19:46
alexgeek's Avatar
Administrator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,769
Blog Entries: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alexgeek
Re: How to create method with functions ?

AS2?
The following may work, I'm typing it straight from my keyboard though.
Code: Select all
on(Click) {
this._rotation += 15;
}

Apply it to the movie clip itself rather than the frame.
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Reply With Quote
  #5 (permalink)  
Old Oct 13th, 2007, 19:51
marSoul's Avatar
Moderator
Join Date: Sep 2007
Location: Tehran - Iran
Age: 28
Posts: 405
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 4 Posts
Send a message via MSN to marSoul Send a message via Yahoo to marSoul
Re: How to create method with functions ?

I know that, i need to create a function and assign it to the button,
like :

function rotate() {
name._rotation += 15;
}
__________________
Designing For Communicating
Website : http://www.datisdesign.com
Weblog : http://blog.datisdesign.com

Last Blog Entry: Throughout IRAN (Dec 10th, 2007)
Reply With Quote
  #6 (permalink)  
Old Oct 13th, 2007, 20:05
alexgeek's Avatar
Administrator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,769
Blog Entries: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alexgeek
Re: How to create method with functions ?

put this in a frame:
Code: Select all
function rotate()  {
this._rotation += 15;
}
and then put this on the movie clip:
Code: Select all
on(Click) {
rotate();
}

I think that should work
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Reply With Quote
  #7 (permalink)  
Old Oct 13th, 2007, 20:11
marSoul's Avatar
Moderator
Join Date: Sep 2007
Location: Tehran - Iran
Age: 28
Posts: 405
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 4 Posts
Send a message via MSN to marSoul Send a message via Yahoo to marSoul
Re: How to create method with functions ?

first it should be :
on(press) {
rotate();
}but the whole scene will rotate with that, i want to rotate a specific object
__________________
Designing For Communicating
Website : http://www.datisdesign.com
Weblog : http://blog.datisdesign.com

Last Blog Entry: Throughout IRAN (Dec 10th, 2007)
Reply With Quote
  #8 (permalink)  
Old Oct 22nd, 2007, 23:03
Multimedia Specialist
Join Date: Apr 2007
Location: Arizona
Age: 25
Posts: 666
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Sgaspar11
Re: How to create method with functions ?

Code: Select all
on(press) {
NAME.rotate();
}
Last Blog Entry: Yay!? (Oct 8th, 2007)
Reply With Quote
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Functions? Jack Franklin PHP Forum 10 Feb 3rd, 2008 16:49
The basic method timmytots Web Page Design 1 Nov 26th, 2005 11:47
Method Not Allowed joshcxa PHP Forum 2 Jul 19th, 2005 01:49
Help with Functions stallion150172 JavaScript Forum 13 Jun 11th, 2004 10:09


All times are GMT. The time now is 17:32.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43