February 08, 2012, 06:11:26 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Prowlie Welcome back! The site migration is complete and normal service resumed.
Advanced search
Pages: [1] 2 3   Go Down
Print
Author Topic: What Does this button do? AS3 Help  (Read 6726 times)
0 Members and 1 Guest are viewing this topic.
TheGrayK
That Awesome Guy You Know
Senior Member
****
Offline Offline

Gender: Male
Posts: 902

Daredevil Extraordinair!


« on: August 30, 2009, 08:19:18 PM »

Thanks I think I was Just about to make that discover I just hadn't looked at the code yet
I made an extra frame at the beginning to set up for this though.
Thanks for the help man it is much appreciated.

Edit:
Ok so I did all of the frame adjustments but know something strange is happening here is the code and the swf so you can see for your self
Code:
test.gotoAndStop(1);

home.addEventListener(MouseEvent.MOUSE_UP, homeclick);
function homeclick(event:MouseEvent):void{
var request = new URLRequest("http://toonani.webs.com/");
    navigateToURL(request,"_self");
}

about.addEventListener(MouseEvent.MOUSE_UP, aboutclick);
function aboutclick(event:MouseEvent):void{
var request = new URLRequest("http://www.toonani.webs.com/about.htm");
    navigateToURL(request,"_self");
}

contact.addEventListener(MouseEvent.MOUSE_UP, contactclick);
function contactclick(event:MouseEvent):void{
var request = new URLRequest("http://www.toonani.webs.com/con
« Last Edit: October 12, 2009, 05:13:36 PM by TheGrayK » Logged

The novelty of my own mortality has yet to be torn,
While the vulgarity of my existence has made its welcome worn.
adzy-2k6
Senior Member
****
Offline Offline

Posts: 717


« Reply #1 on: August 31, 2009, 09:23:55 AM »

I can't remember the specific code, but all you need to do is use the code to hide the normal cursor, and then set the image you want to replace it with at the current co-ordinates of the cursor.After that, its as simple as updating the location. There is no code as far as i know that changes the cursor itself, you need to do it manually.
Logged

TheGrayK
That Awesome Guy You Know
Senior Member
****
Offline Offline

Gender: Male
Posts: 902

Daredevil Extraordinair!


« Reply #2 on: August 31, 2009, 06:47:37 PM »

Thanks  Grin
the first thing you are talking about that is what im trying to do
but effin actionscript is so hard
Logged

The novelty of my own mortality has yet to be torn,
While the vulgarity of my existence has made its welcome worn.
Jaehl
Mobal Gloderator
Global Moderator
Veteran
***
Offline Offline

Gender: Male
Posts: 1417


/* No comment */


WWW
« Reply #3 on: September 01, 2009, 09:27:21 AM »

I can't remember the specific code, but all you need to do is use the code to hide the normal cursor, and then set the image you want to replace it with at the current co-ordinates of the cursor.After that, its as simple as updating the location.
It's even easier than that; you just need one line to hide the cursor and one to move the image around.
Code:
Mouse.hide();
someMovieClip.startDrag(true);
Logged


<a href="http://i17.photobucket.com/albums/b90/Jaehll/Actionscript_Banner.swf" target="_blank">http://i17.photobucket.com/albums/b90/Jaehll/Actionscript_Banner.swf</a><a href="http://img.photobucket.com/albums/v661/Vector88/motm.swf?vTitle=oct%2Fnov%2007.swf" target="_blank">http://img.photobucket.com/albums/v661/Vector88/motm.swf?vTitle=oct%2Fnov%2007.swf</a>
Sarus translator:
<a href="http://www.jaehl.com/files/progress.swf" target="_blank">http://www.jaehl.com/files/progress.swf</a>
adzy-2k6
Senior Member
****
Offline Offline

Posts: 717


« Reply #4 on: September 01, 2009, 09:39:24 AM »

You also need to create the movie clip and place it on the stage. Still, your way is a lot easier once that is done (and he can probably get away with declaring it as a sprite, providing the cursor only has one frame).
Logged

TheGrayK
That Awesome Guy You Know
Senior Member
****
Offline Offline

Gender: Male
Posts: 902

Daredevil Extraordinair!


« Reply #5 on: September 01, 2009, 10:09:05 AM »

It's even easier than that; you just need one line to hide the cursor and one to move the image around.
Code:
Mouse.hide();
someMovieClip.startDrag(true);

Thanks!
there is so much syntax that i dont know


Can anyone tell me if there is a better looking way to do that first part?
Logged

The novelty of my own mortality has yet to be torn,
While the vulgarity of my existence has made its welcome worn.
Jaehl
Mobal Gloderator
Global Moderator
Veteran
***
Offline Offline

Gender: Male
Posts: 1417


/* No comment */


WWW
« Reply #6 on: September 01, 2009, 10:19:07 AM »

Can anyone tell me if there is a better looking way to do that first part?
Nope, that's about as short as it gets. Smiley
Logged


<a href="http://i17.photobucket.com/albums/b90/Jaehll/Actionscript_Banner.swf" target="_blank">http://i17.photobucket.com/albums/b90/Jaehll/Actionscript_Banner.swf</a><a href="http://img.photobucket.com/albums/v661/Vector88/motm.swf?vTitle=oct%2Fnov%2007.swf" target="_blank">http://img.photobucket.com/albums/v661/Vector88/motm.swf?vTitle=oct%2Fnov%2007.swf</a>
Sarus translator:
<a href="http://www.jaehl.com/files/progress.swf" target="_blank">http://www.jaehl.com/files/progress.swf</a>
TheGrayK
That Awesome Guy You Know
Senior Member
****
Offline Offline

Gender: Male
Posts: 902

Daredevil Extraordinair!


« Reply #7 on: September 01, 2009, 11:10:30 AM »

Dang oh well thanks for that actionscript it worked perfectly

You also need to create the movie clip and place it on the stage. Still, your way is a lot easier once that is done (and he can probably get away with declaring it as a sprite, providing the cursor only has one frame).

does this mean i cant animate it?
if it does why not?
EDIT: I tested it and animating it works so you were talking about something else
2 questions
what would be the benefits of declaring it a sprite?
and why wouldn't i be able to animate it if i did?
Logged

The novelty of my own mortality has yet to be torn,
While the vulgarity of my existence has made its welcome worn.
adzy-2k6
Senior Member
****
Offline Offline

Posts: 717


« Reply #8 on: September 01, 2009, 11:16:42 AM »

A spirite is basically a one frame movie clip :/. If you intend more than one frame, you can just declare it as a movie clip. On second thoughts, just call it a MovieClip. That will allow you to add animation if you wish, without having to go and change the coding Smiley
Logged

TheGrayK
That Awesome Guy You Know
Senior Member
****
Offline Offline

Gender: Male
Posts: 902

Daredevil Extraordinair!


« Reply #9 on: September 02, 2009, 01:46:04 AM »

Thank you adzy that was very helpful
I appreciate all of the help from you guys
if i have anymore questions i will post them in this thread
Logged

The novelty of my own mortality has yet to be torn,
While the vulgarity of my existence has made its welcome worn.
supermoose
Full Member
***
Offline Offline

Gender: Male
Posts: 240


Yes. I beat IWBTG. Only took ~60 hours of play.


« Reply #10 on: September 03, 2009, 10:36:58 AM »

[Edited by the moose for readability]
There are actually benefits to using a sprite.  A sprite is much less memory intensive than a 1 frame movie clip.  A movie clip has to animate.  i.e. It starts, hits its end, and restarts its cycle every time you enter a frame.  A sprite loads its one frame and displays.  The main difference being the sprite doesn't try to loop and calculate the next frame, it knows it only has one.  This is useful if you are planning on putting many different movie clips inside of another, as that is often a good way of organizing yourself.  Many tutorials (Actionscript Gaming University for example) tell you to spawn all of your enemies inside of a master "gameLevel" MovieClip.  Now, your computer loads up the frame for the gameLevel, and then has to calculate all of your enemies next frames as well, leading to compounding, or nesting, calculations.  A sprite has very few calculations associated with it, eliminating one level of the nesting calculations.  Mainly they are an organizational thing with very low overhead.  Compounding movie clips can be costly.

Also, in response to your earlier mouse question, startDrag sets the registration point (the black plus sign) over the tip of the mouse, if you want to center the movieclip or put a different corner over the edge, you would need an event listener for ENTER_FRAME where clip.x = mouse.x
« Last Edit: September 04, 2009, 03:25:58 PM by supermoose » Logged

adzy-2k6
Senior Member
****
Offline Offline

Posts: 717


« Reply #11 on: September 04, 2009, 09:27:45 AM »

Does that mean sprites can have multiple frames, but you have to define which it should show ?. I always assumed that it was just a sinlge frame movie clip :/
Logged

Jaehl
Mobal Gloderator
Global Moderator
Veteran
***
Offline Offline

Gender: Male
Posts: 1417


/* No comment */


WWW
« Reply #12 on: September 04, 2009, 09:42:35 AM »

A sprite is basically a movie clip with no timeline, so it just has the one frame.
Logged


<a href="http://i17.photobucket.com/albums/b90/Jaehll/Actionscript_Banner.swf" target="_blank">http://i17.photobucket.com/albums/b90/Jaehll/Actionscript_Banner.swf</a><a href="http://img.photobucket.com/albums/v661/Vector88/motm.swf?vTitle=oct%2Fnov%2007.swf" target="_blank">http://img.photobucket.com/albums/v661/Vector88/motm.swf?vTitle=oct%2Fnov%2007.swf</a>
Sarus translator:
<a href="http://www.jaehl.com/files/progress.swf" target="_blank">http://www.jaehl.com/files/progress.swf</a>
TheGrayK
That Awesome Guy You Know
Senior Member
****
Offline Offline

Gender: Male
Posts: 902

Daredevil Extraordinair!


« Reply #13 on: September 04, 2009, 12:47:14 PM »

So to clear some confusion
A sprite is a graphic that does not have frames
therefore no animation?
Logged

The novelty of my own mortality has yet to be torn,
While the vulgarity of my existence has made its welcome worn.
supermoose
Full Member
***
Offline Offline

Gender: Male
Posts: 240


Yes. I beat IWBTG. Only took ~60 hours of play.


« Reply #14 on: September 04, 2009, 03:16:59 PM »

right, the sprite only has one frame.  There is no "animating" it, only displaying the single frame.  This saves a lot of background calculations, and frees up resources.  Sorry If I was unclear.
Logged

Brackenwood
   

 Logged
Pages: [1] 2 3   Go Up
Print
Jump to:  

Theme by Pieter, based on Black Rain by Crip Powered by SMF 1.1.15 | SMF © 2011, Simple Machines XHTML | CSS

Page created in 0.072 seconds with 24 queries.