06-30-2006, 05:24 PM
|
#46
|
|
|
thanks that makes more sense.
NEW Question, and maybe I am just all together spacing out on this one.. but uhm where are the Tween Classes?
I attempted to do import mx.effects.Tween... but that doesnt work, nor do i think it should. I hunted through all the class files, and those still all look flash 8.
Can ya gimme a hint as to how to get going tweening things with AS3? I know i could make my own timers and do it myself, but I am looking to find out what happened to the Tween Class.
Also where does flash store the class files i am importing. for example where is flash.display.MovieClip. Does that class file exist on my computer? or is it in the flash player? can i use mx classes? if so where are those located for AS 3?
Any help would be appriciated, i am pretty much looking for a simple example like.. there is a circle movieclip made with a class, function called bounceIt. and in the bounceIt function it creates a new tween and bounces the ball up and down.
Sorry if these are all retarded, just trying to get a head start 
__________________
//Insert Signature Here
Kirupa.chaosWarp.signature = 1
Last edited by Chaoswarp; 06-30-2006 at 06:05 PM..
|
|
|
07-01-2006, 01:10 AM
|
#48
|

 |
San Francisco, CA (USA) |
|
 |
17,426 |
|
|
Detecting When the Mouse Leaves the Movie
One thing about previous versions of ActionScript was that you could never tell when the user no longer had his or her mouse over the Flash movie. This made it hard for people to know whether or not the user is still interacting with their movie or if they've given up and moved on to something more interesting. This was especially a problem for custom cursors where, if the user moved the cursor off the Flash movie, the custom cursor would still remain in the Flash movie not moving while the real cursor could be seen moving around every where else.
ActionScript 3 now allows you to detect when the mouse has left the flash movie using the stage's mouseLeave event. This event happens whenever the mouse exits the Flash movie. There is no mouseEnter event, but you can use mouseMove for that since mouseMove only occurs in Flash (for the stage, or really any, object) when the mouse is within the bounds of the movie.
Here's a simple example that uses a square as a custom cursor:
Code:
package {
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.ui.Mouse;
public class Test extends Sprite {
private var cursor:Sprite = new Sprite();
public function Test() {
cursor.graphics.beginFill(0xFF);
cursor.graphics.drawRect(0, 0, 25, 25);
addChild(cursor);
stage.addEventListener(Event.MOUSE_LEAVE, cursorHide);
stage.addEventListener(MouseEvent.MOUSE_MOVE, cursorFollow);
Mouse.hide();
}
public function cursorHide(evt:Event):void {
cursor.visible = false;
}
public function cursorFollow(evt:MouseEvent):void {
if (!cursor.visible) cursor.visible = true;
cursor.x = stage.mouseX;
cursor.y = stage.mouseY;
evt.updateAfterEvent();
}
}
}
As your mouse leaves the movie, the cursor sprite is hidden. When the mouse is brought back in the movie, the mouseMove event fires and the cursor is made visible again.
__________________

|
|
|
07-01-2006, 12:22 PM
|
#49
|
|
|
Hmmmm well if the tween classes still exist, and should work the same. what am I doin wrong?
I got a movieclip mc on the timeline, ofcourse.
Code:
import mx.effects.Tween
var t = new Tween(mc, "_rotation", Elastic.easeOut, 0,360, 3, true)
this gives me a compiler error
Quote:
ReferenceError: Error #1065: Variable Tween is not defined.
at Timeline0_63425fcc21fc6e4194dfe8880df15cd/::frame1()
|
So what is the proper way to get access to the Tween class?
__________________
//Insert Signature Here
Kirupa.chaosWarp.signature = 1
|
|
|
07-01-2006, 04:34 PM
|
#52
|
|
|
Actually it's in mx.effects.easing
__________________
Proud Montanadian
 We tolerate living and breathing.
Name Brand Watches
|
|
|
07-01-2006, 05:23 PM
|
#53
|
|
|
hehe yah knew about the other classes, figured it was pointless if i couldnt find this one.
thanks though, saves me some headache. Also is it just me, or does the code Check in flash IDE not work on AS 3 classes?
senocular - Can I get the updated Class files from the SDK or some from flex somewhere? like just copy them over my other ones? Or do i need to develop in flex until they release a new flash 9, if i wanna use those features?
thanks
__________________
//Insert Signature Here
Kirupa.chaosWarp.signature = 1
|
|
|
07-03-2006, 01:43 PM
|
#57
|
|
|
Quote:
|
Originally Posted by senocular
Here's a simple example that uses a square as a custom cursor:
Code:
...
public function cursorFollow(evt:MouseEvent):void {
if (!cursor.visible) cursor.visible = true;
cursor.x = stage.mouseX;
cursor.y = stage.mouseY;
evt.updateAfterEvent();
}
|
Pls, comment on evt. updateAfterEvent(); , I know what updateAfterEvent() function does, but placing evt object before it confuses me.
It instructs player to refresh stage after event completes, right?
Why don't just write
Code:
updateAfterEvent();
?
I'll be thankfull if someone will point me on docs describing updateAfterEvent();
|
|
|
07-03-2006, 02:06 PM
|
#58
|
|
|
updateAfterEvent() is a method of the MouseEvent class, not a global function, so you need to call it from an instance of the MouseEvent class, in this case, 'evt'.
It is also a method of the KeyboardEvent and TimerEvent classes.
Here is the link to the documentation: http://livedocs.macromedia.com/labs/...teAfterEvent()
|
|
|
07-04-2006, 11:00 AM
|
#59
|

 |
San Francisco, CA (USA) |
|
 |
17,426 |
|
|
Commas in Shorthand Array Definitions
When defining arrays in ActionScript 3 using the shorthand array access operator (brackets), you can now have a trailing comma following the last element without causing an error (like in PHP). This makes working with multi-line array definitions a little less error-prone when rearranging elements. Ex:
Code:
var myList:Array = [
"The",
"quick",
"brown",
"fox",
];
In ActionScript 1 and 2, the comma after "fox" would create an error. This is not the case in ActionScript 3.
Note: this does not work with Array() or new Array(), only [].
__________________

|
|
|
07-04-2006, 11:14 AM
|
#60
|

 |
San Francisco, CA (USA) |
|
 |
17,426 |
|
|
Package Block
Packages in ActionScript 3 are defined a little differently than they are in ActionScript 2. In ActionScript 3, the package path is no longer part of the class definition. Instead, it is part of a new block which contains your class, the package block defined with the package keyword. That gives you the following basic structure for AS3 files:
Code:
package my.package.path {
class MyClass {
}
}
In AS2, it would look like the following:
Code:
// ActionScript 2:
class my.package.path.MyClass {
}
In fact, in AS3, all class files require a package block, even if they are not in a package.
Code:
package {
class NotInAPackageClass {
}
}
Each package block can define a class or a function that is associated with the file. The class or function within the block should be defined with the same name as the file (minus the .as extension).
Code:
package com.kirupa.utils {
function StripString(str:String):void {
// ...
}
}
The above would be saved as StripString.as in a com/kirupa/utils folder.
__________________

|
|
|
|
Currently Active Users Viewing This Thread: 7 (0 members and 7 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 10:56 PM.
|
|