-
yea i meant my question about the rightCLICK
when i tried ur new code i get an error
1119: Access of possibly undefined property buttonDown through a reference with static type Class
-
Oops. I missed that error. You were also using buttonDown as an event constant, but it's not. You wanted MOUSE_DOWN.
Code:
mastButton.addEventListener(MouseEvent.MOUSE_DOWN, rightCLICK);
function rightCLICK(e:MouseEvent):void{
if(!e.buttonDown){
s.writeUTFBytes("mastButton"+" was righCLICKED");
}
}
-
ok no errors now.
problem is when i right click now on the button, the context menu comes up. you know the one that says
Code:
ZOOM IN
ZOOM OUT
100%
Quality >
Print
Show Redraw Regions
etc..
-
It sure does. Your other thread about that question has more information.
( http://board.flashkit.com/board/showthread.php?t=805792 for the people searching the archives in the future ).
-
i did try that but that website's code has never worked for me
heres the code he gives on that site, i had to take out the "package" part, and the "class", "public", and "private" parts cause i get errors for those
Code:
import flash.display.*;
import flash.external.ExternalInterface;
RightClick extends Sprite
{
function RightClick()
{
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
var methodName:String = "rightClick";
var method:Function = onRightClick;
ExternalInterface.addCallback(methodName, method);
}
function onRightClick():void {
var mx:int = stage.mouseX;
var my:int = stage.mouseY;
if(my> 0 && my <stage.stageHeight && mx> 0 && mx <stage.stageWidth) {
trace("mastButton"+" was rightCLICKED");
}
}
first off its saying i have extra characters at the end of the program which i don't, and also everytime i play around with it i get errors
i don't think i know enough about as3 to understand this.
i can understand most of the onRightClick function expect the important part:
Code:
if(my> 0 && my <stage.stageHeight && mx> 0 && mx <stage.stageWidth
and what does RightClick extend sprite mean?
u dont' have to answer all these questions if u dont want, im just sayin for future archives haha, im too ignorant to understand why ppl have to put codes nested in packages and so forth online...it always gives me errors
-
When you find code with a package statement, or using public/private/etc, that is intended to be an external .as file. You can't just copy and paste it into an actions layer, because it's intended to describe an entire class. Code in an actions layer is already in a package and class, but you don't normally have to care about that.
Let's keep the right-click discussion in your right-click thread.
-
-
hey can u do me one last favour? can u go thorugh and explain the variables, like
embeddedNums,
ProcessToken
tokens
socketBuffer
and just briefly how they're workin together
thanks!
-
Sure. embeddedNums is now a bit of a misnomer since it is not entirely numbers. What it is, is an array that consists of two parts: The stuff to the left of '+' and the stuff to the right of '+'. The first part is the name of the clip, and the second is the index of the frame to go to.
There is nothing called 'ProcessToken'. But there is 'processToken' (lowercase p). processToken is a function which takes a message from your socket and acts on it. Your messages are of the form clipName+frameIndex. All processToken does is split that message up and interpret the parts. It does a little bit of validation to make sure that there are enough parts and that the named clip does exist, then sends the clip to the specified frame.
tokens is another array. It is made of the parts of socketBuffer between '.'s. That is, it should consist of messages, except for perhaps the last entry which might not be a complete message. That's why the loop goes until tokens.length == 1, so that the last message isn't processed too early.
socketBuffer is a String. When stuff comes in from the socket, it gets added to socketBuffer. That way we can build up incomplete messages into complete messages to be processed. For example, say that the following stuff comes in from the socket at different times: "s", "2", "+2", "." If we attempted to process each of those separately, they wouldn't mean anything. So by sticking them into a buffer until the message is built we can ensure that we process complete messages. After we process the messages, we need to set the socketBuffer back to the last unprocessed message so that we don't process the same message twice. That's why it gets set back to the last token in tokens.
-
whoa.....thats hella clever. thanks!
-
i've learned that tracing things is really helpful i finally figured out how to do something with my sliders:
Code:
trace(if (this[clipName]){
this[clipName].y=(frameIndex);
only problem with this is it's obviously gonna send ANY clip name to a new y coordinate, and when i tell my other movieclips to go to a certain frame, i dont' want them jumpin all over the screen.
so i wanted to sayif(this[clipName]comes from the FADERarray){
this[clipName].y=(frameIndex);
so i tried this
Code:
if (this[clipName.concat(FADERarray])){
this[clipName].y=(frameIndex);
i don't see why that wouldnt work cause when i traced clipName.concat(FADERarray) it showed a list of all the instances in the FADERarray, but it doesnt move the sliders to the correct y coordinate anymore. but I think I'm really close with it
-
concat is a method of a String which takes arguments, converts them to Strings, then appends them to the original String and returns the new value. For simplicity's sake, let's say clipName is "s1" here, and FADERarray is ["s1", "s2", "s3"].
clipName.concat(FADERarray) is the same as:
"s1".concat(["s1", "s2", "s3"])
Since the argument is an array, it is converted to a String by calling toString on it. That is, the statement is the same as:
"s1".concat("s1, s2, s3");
So you take that second string and you append it to the first, and you get:
"s1s1, s2, s3"
There is no clip named "s1s1, s2, s3" so the condition of the if statement always fails.
If you wanted to find out whether "s1" is in FADERarray, you can use the indexOf method of FADERarray
Code:
if (FADERarray.indexOf(clipName) != -1){
this[clipName].y = frameIndex;
}
-
problem solved! i always new indexOf would be essential one day when it came to using arrays
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|