Flash CS3 - Flash CS4

Free tutorials and scripts for all.
Actionscript 3.0

declaring variables

This is a discussion on declaring variables within the Flash CS3 eng forums, part of the English Forums category; hi just wondering if someone can tell me how I can declare a start variable on a draggable movieclip so ...


Go Back   Forum Flash CS3 Flash CS4 > English Forums > Flash CS3 eng

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 20-08-08, 02:28
Junior Member
 
Join Date: Aug 2008
Posts: 6
Rep Power: 0
Aaron24 is on a distinguished road
declaring variables

hi just wondering if someone can tell me how I can declare a start variable on a draggable movieclip so that it snaps back to its starting position in once the stopDrag has been called
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #2 (permalink)  
Old 20-08-08, 15:16
Onsitus's Avatar
CSS.FlepStudio.org
 
Join Date: Jul 2007
Location: Nettuno Beach
Posts: 1,012
Rep Power: 3
Onsitus is on a distinguished road
Re: declaring variables

Quote:
Originally Posted by Aaron24 View Post
hi just wondering if someone can tell me how I can declare a start variable on a draggable movieclip so that it snaps back to its starting position in once the stopDrag has been called
Hi, declare your var to start with, recall them when the drag stops
Esempio to start:

var xStart:Number = clip._x; //could also be a number
var yStart:Number = clip._y;

when the drag stops:

clip._x=xStart;
clip._y=yStart;

Then to apply to your code.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #3 (permalink)  
Old 21-08-08, 01:17
Junior Member
 
Join Date: Aug 2008
Posts: 6
Rep Power: 0
Aaron24 is on a distinguished road
Re: declaring variables

Quote:
Originally Posted by Onsitus View Post
Hi, declare your var to start with, recall them when the drag stops
Esempio to start:

var xStart:Number = clip._x; //could also be a number
var yStart:Number = clip._y;

when the drag stops:

clip._x=xStart;
clip._y=yStart;

Then to apply to your code.
thanks for that
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #4 (permalink)  
Old 21-08-08, 16:53
Junior Member
 
Join Date: Aug 2008
Posts: 6
Rep Power: 0
Aaron24 is on a distinguished road
Re: declaring variables

on (press) {
var x:Number = _122;
var y:Number = _223;
startDrag(this, true, 0, 0, 550, 400);
}
on (release) {
stopDrag();
_223=y
_122=x

this is the code i have the movieclip can someone please tell me where I am going wrong as it will not snap back to its starting position
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #5 (permalink)  
Old 21-08-08, 18:20
Onsitus's Avatar
CSS.FlepStudio.org
 
Join Date: Jul 2007
Location: Nettuno Beach
Posts: 1,012
Rep Power: 3
Onsitus is on a distinguished road
Re: declaring variables

on (press) {
startDrag(this, true, 0, 0, 550, 400);
}
on (release) {
stopDrag();
this._y = 223;
this._x = 122;
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Flash Multi Gallery
  #6 (permalink)  
Old 22-08-08, 00:35
Junior Member
 
Join Date: Aug 2008
Posts: 6
Rep Power: 0
Aaron24 is on a distinguished road
Re: declaring variables

thanks for your help that worked
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #7 (permalink)  
Old 22-08-08, 01:31
Junior Member
 
Join Date: Aug 2008
Posts: 6
Rep Power: 0
Aaron24 is on a distinguished road
Re: declaring variables

hopefully last question if I wanted to retain a button type function on the movieclip so that if it wasnt clicked it could go to _leve0.frame40 what sort of loop or condition statement would be need there?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #8 (permalink)  
Old 22-08-08, 08:39
Onsitus's Avatar
CSS.FlepStudio.org
 
Join Date: Jul 2007
Location: Nettuno Beach
Posts: 1,012
Rep Power: 3
Onsitus is on a distinguished road
Re: declaring variables

Quote:
Originally Posted by Aaron24 View Post
hopefully last question if I wanted to retain a button type function on the movieclip so that if it wasnt clicked it could go to _leve0.frame40 what sort of loop or condition statement would be need there?
Ciao,

sorry I did not understand your question.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #9 (permalink)  
Old 24-08-08, 12:57
Junior Member
 
Join Date: Aug 2008
Posts: 6
Rep Power: 0
Aaron24 is on a distinguished road
Re: declaring variables

the project on which we are working we have to be able to drag the movieclip around and have it snap back but if the user does not drag the clip around the screen it has to go to a different screen frame so the clip acts like a button aswell
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #10 (permalink)  
Old 24-08-08, 21:43
Onsitus's Avatar
CSS.FlepStudio.org
 
Join Date: Jul 2007
Location: Nettuno Beach
Posts: 1,012
Rep Power: 3
Onsitus is on a distinguished road
Re: declaring variables

Going to a different screen frame....a double click would be ok?

On one click it drags, on double click its goes to next screen.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Reply

Bookmarks

Thread Tools
Display Modes

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 On
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads

Thread Thread Starter Forum Replies Last Post
Passing variables from HTML to Flash CS3 Flep Tutorials 24 25-11-08 22:36
Actionscript 3 variables and functions from child movieclip coma Actionscript 3.0 newbies 9 25-11-08 21:41
Actionscript 3 Declaring variables in AS 3.0 Pherankh Actionscript 3.0 newbies 0 24-06-08 22:13
Displaying PHP Variables in Flash chosendesigns PHP | mySQL | Flash CS3 1 14-05-08 13:49
Tutorial 1 the variables Flep Actionscript for beginners - tutorials 0 01-11-07 06:47


All times are GMT. The time now is 15:10.


Powered by vBulletin versione 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC4
Forum SiteMap


FlepStudio
by Filippo Lughi
P.IVA 03605860406