Click to See Complete Forum and Search --> : custom cursor.
BreakPoint
06-26-2002, 05:58 PM
I was trying to do a custom cursor. I created a shape and made into a movie
And then in the sound n actions added an actionscript
startDrag ("_root.mc1", true);
Mouse.hide();
But there seems to be a distance between the actual cursor and the custom cursor. When i moved the cursor to the flash, the cursor seems to trails behind or be in front of where the actual cursor shud be.
Any help?.
johnie
06-26-2002, 06:23 PM
Instead of using Start Drag, which shouldn't work as you typed it BTW the Syntax is myMovieClip.startDrag([lock, [left, top, right, bottom]]), try this instead:
onclipevent(enterframe){
this._x=_root._xmouse;
this._y=_root._ymouse;
mouse.hide();
}
You will place this on the clip instead of as a Frame event. In order to place this on your clip double click your MC and then assigtn it in the Behavior Tab under Actions.
BreakPoint
06-26-2002, 07:03 PM
thanks johnie. that worked like a marvel. well the startDrag stuff i had read on some of the flash tutorial sites. and thats how they had written the script.
thanks anyway.
johnie
06-26-2002, 07:34 PM
The way that they used it is the Flash 4 Syntax Model... It should not have worked in KM as KM shouldn't support the Flash 4 AS Model.
Anyhow if you wanted to use StartDrag using the Flash 5 Model the Syntax would be this:
mc1.StartDrag(true);
Mouse.Hide();
The synatx I showed you is the Flash 5 Model. If it worked then Bob implemented the Flash 4 synatx model for StartDrag along with the Flash 5 Model. It is possible that he did that. I'll have to check it.
The Flash 4 Syntax is StartDrag("target",[lock, top, left, bottom,right])
It is quite possible that he did add it as I imagine that many people asked for the Flash 4 Syntax to be added as most Flash AS tuts mix the syntax or exclusively use the Flash 4 Syntax outright.
This is also why So many people have problems with Actionscript. The Flash 5 and MX Syntax Models are very close to Ecma (262) in which they are based. If you know Javascript, JScript, or ECMA then it is a very short hop to knowing the Flash 5 Actionscript Model. The Flash 4 Syntax Model was based of something called Simple Script. It is more is more like Fortran or even a bit like the Original BASIC language although to be honest its not much like anything except Flash 4 Actionscripting. It makes little or no sense to me to be completly honest. The problem here is that All Versions of Flash are designed to be Backwards compatible. Macromedia designed Flash so that both the AS 4 and AS 5/ MX Models exist at the same time. There are two syntax models happening at the same time and they can be mixed intermitantly thus leaving you with two diffrent competing syntax models intermixed.
bridelh
06-26-2002, 09:01 PM
G'Day BreakPoint,
You can make your custom cursor move alot smoother by using this syntax:
onclipevent(load){
this.startdrag(true);
mouse.hide();
}
onclipevent(mousemove){
updateafterevent();
}
The updateAfterEvent() will refresh the movie everytime the mouse is moved instead of waiting for the next frame to pass.
For everyones information, all the code mentioned in this thread can be found in the Koolmoves examples folder - it is always worth looking there for simple stuff - or you can see some examples at my site:
http://www.bridel.org/
Regards
Hilary
--
johnie
06-26-2002, 09:38 PM
I checked it.
The Flash 4 StartDrag syntax indeed has been added into 3.20 although it is not listed in the syntax help utilty.
Also it seems that when you use this syntax the Movieclip lines up different than using Movieclip.StartDrag()
No explanation for the diffrence.
Hillary that is pretty good thinking adding that upadate after event but does this effect drag? I always assumed that Drag should drag regardless if the frame has passed or not. It certianly will continue to drag if a stop movie action is placed.
Aditional Note: The example file version of the cursor was written for KM version 2.8 and is called Dragable Sprite (done by adjusting the _x and _Y position and uses the older SWF Object). There isn't an example of Startdrag under the AS Examples it is located under Movieclip examples listed under update after event instead.
It is the same example I believe that Hilary has posted.
BreakPoint
06-26-2002, 10:16 PM
Thanks again johnie for the input
and thanks hilary for the script.
But I had checked the actionscript reference and these flash tutorial sites mentioning that this was for flash 5.
now maybe because flash 5 has backward compatibility with flash 4 model, it worked for them.
My question is there any place where I can find flash 5 only syntax, the ones used in kool moves?
johnie
06-26-2002, 10:23 PM
The stuff me and Hilary and others at this forum should be KM ready...
Also LM 2 scripts follow almost the same syntax with an exception of the event handlers.
Also get Mooks book and he explains the differences between the two.
bridelh
06-26-2002, 10:24 PM
Originally posted by johnie
Hillary that is pretty good thinking adding that upadate after event but does this effect drag? I always assumed that Drag should drag regardless if the frame has passed or not. It certianly will continue to drag if a stop movie action is placed.
Hi Johnie, Yes it does affect drag.
You can see the result of updateAfterEvent() by opening up the dragable sprite example within the KM examples, and changing the movie speed to 6 frames per second. When you run it and move your mouse around the screen quickly, you will see that the object jumps across the screen.
Now open up the upDateAfterEvent example and change that movies speed to 6 frames per second. You will see that the object moves VERY smoothly regardless of the frame rate.
Why? - well, acording to "The Bible" (ActionScript - The Difinitive Guide - http://www.moock.org/asdg/) even if you have a stop movie action on every frame, the player still updates the screen at the frame rate set.
updateAfterEvent() used with clip events mouseMove, mouseDown, mouseUp, keyDown and keyUp will force the screen to refresh as these event occur.
Hilary
--
johnie
06-26-2002, 10:28 PM
That's good to know that drag is effected by FPS.
Also to those looking for a AS refference book the Mook book is one of the best.
mmreed
06-26-2002, 10:42 PM
Originally posted by johnie
That's good to know that drag is effected by FPS.
Also to those looking for a AS refference book the Mook book is one of the best.
Johnie - any estimate on when your ebook is coming out?
johnie
06-26-2002, 11:10 PM
A few months if I progress at a good speed on it. It's hard work getting all this down.
Also note that the AS portion will not be all of the book but only part of it.
flashkit.com
Copyright WebMediaBrands Inc., All Rights Reserved.