ActionScript 3 :: What Is The Point Of Void When Following Function
Nov 25, 2010Simple question here, when void follows a function in AS3 what is it doing?
public function sayGoodbye():void {
trace("Goodbye from MySubClass");
}
Simple question here, when void follows a function in AS3 what is it doing?
public function sayGoodbye():void {
trace("Goodbye from MySubClass");
}
I use Flashdevelop as my IDE. It is defaulting to write void with a capital V which reads Void and is causing CS5 to throw an error.
View 2 RepliesThis one has been puzzling me for ages... I've been using a lot of friends of ed books and noticed that a lot of them use the following:
[Code]...
I noticed that i can set a return type on a function to 'Void' aswell as 'void' and just wondered if there was and benefit of either?
View 3 Repliesim having this errors:
1021: Duplicate function definition function onComplete1(event:Event):void {
1021: Duplicate function definition function stopSound1(event:MouseEvent):void {
1021: Duplicate function definition function backSound1(event:MouseEvent):void {
codes i used:
Code:
var thereReq:URLRequest = new URLRequest("SOUNDS/how.mp3");
var there:Sound = new Sound();
var thereControl:SoundChannel = new SoundChannel();
[code]....
Today I've received a small ActionScript 3 application that I need to have a look at and make some changes to.I've noticed that the entire application is riddled with the return keyword, eg:
// Constructor
public function MyClass()
{
// some logic[code].....
Is there a possible reason for this, or is the developer who worked on this using some weird, self-taught practice?
I am making this interactive flash card, and dont have any problems so far, however, I get this error:
Location: Scene 1, Layer 'AS' {this is the layer I use for my actionscript}, Frame 1, Line 11
Description: Warning: 3553: Function value used where type void was expected. Possibly the parentheses () are missing after this function reference.
Source: roteren;
This is the piece of code its referring to:
function klokklik (evt:MouseEvent) {
draai = 0;
geklikt = 1;
roteren;
}
And roteren; refers to the function roteren:
function roteren (evt:Event) {<lots of code here>
}
Code:
for (var i:int = 0; i < menuArray.length; i++) {
var currentIndex:MovieClip = this["menuButton" + i]
currentIndex.menuButtonTxt.text = menuArray[i];
[code]...
So when I did this the problem that I am having is that it throws an error at compile time. 1067: Implicit coercion of a value of type void to an unrelated type Function.
I just don't get the difference when to use VOID or Not .. with so many tutorials I have read, some use void, and sometimes they don't within very similar circumstances ..
Code:
function onEnterFrame(Void):Void
{
}
//and
[Code]....
What is the use of void in Action Script 3.0?
View 3 RepliesI am trying to link to a pdf and show,hide an under line when I roollover a button trough an external class call Plans. This is the error I am getting in line 45:
Warning: 3590: void used where a Boolean value was expected. The expression will be type coerced to Boolean.
My button is called fp_1 and the line is called line_fp_1.This is my code .as:
ActionScript Code:
package mlc
{
import flash.display.*;
[code]....
I create this : function money () {total++;income.text=total;} and a button. income.text is added by 1 each time the button is onRelease. I need only 1 point to be added no matter how many time the button is pressed.
View 8 RepliesThe following is a link to an online floor planner:[URL]..Does anyone know how to achieve the anchor point function? If you click on a "wall" it adds an anchor point.
View 0 RepliesI have found no practical use for it really. Someone wanna shed some light on the subject? Example Usage: Code: var Dict:Dictionary = new Dictionary();
View 1 RepliesI have an FLVPlayback component with several ActionScript cue points designated along its timeline. I've written a listener that successfully executes a function whenever the video reaches one of my cue points. However, I'd like it to do different things depending on which of the cue points it has reached.
Here is my code:
Code:
// these are the cue points that I'm adding to my video
_root.thevid.addASCuePoint(33, "show1");
_root.thevid.addASCuePoint(43, "hide1");
[Code]....
Essentially, I would like for the function to accept a String name from the cue point, and then decide which action to take (either showing or hiding something). I don't know the correct syntax for accepting information from the cue point. Should I pass the cue point into the function as an object, then parse its name from within the function?
I've started the OO Scrollbar tutorial part 1 and when i went to test the movie i got the following 1046 error on 14 lines
Code: Select all Tweener.as Line 861 1046: Type was not found or was not a compile-time constant: Void. I added the caurina file to a folder on my desktop as shown in the tutorial and added it to my preferences in flash but still no joy. i tried the following moving the caurina file to the folder holding my fla in the publish settings i added the class directory in the original folder i did on my desktop i moved the caurina file next to the com folder rather than under it i moved the caurina file to the adobe flash config folder when the folder was under com i changed the as file so it was Code: Select allclass com.caurina.transitions.Tweener { and did the same in my actions layer of the movie where is the best place to put it, do i have to change the coding in the as files....
I posted a while back looking for a function to make one movieClip circle around a fixed point. The solution I was given (which has worked perfectly up until now) is:[code]This function is called repeatedly by a Timer (loopTimer) with delay 10.The problem I have hit now though, is that if I want to modify or reverse the speed of rotation at any point it causes a jump in position (because I am setting the x and y values directly, rather than incrementing them e.g. "x = ..." rather than "x += ..."). Can anyone see a way to modify this function so that I can just increment the x/y positions?
View 5 Repliesi'm searching for a function that return the mouse movement as Cardinal Point.In other words i would like to have as returned value, if mouse is going from down to top, North, if mouse move from left to right, should return East ... and so on
View 3 RepliesCS4-AS3 Full screen browser error This is my preloader on the first frame.
Code:
stop();
this.loaderInfo.addEventListener (ProgressEvent.PROGRESS, PL_LOADING);
function PL_LOADING(event:ProgressEvent):void {
var pcent:Number=event.bytesLoaded/event.bytesTotal*100;
[code]....
Errors:
Code:
1046: Type was not found or was not a compile-time constant: Void. - function stageResize():Void { - frame 2 line 10
Code:
Warning: 1058: Migration issue: The property _height is no longer supported. Use the DisplayObject.height property instead.- bg_ratio = bg_mc._width / bg_mc._height; - frame 2 line 6
I am currently trying to create a function (or set of functions) that automatically fades in a button for each cue point in a video the first time a video loads. This way the buttons only become accessible once that point in the video has passed. The buttons should stay active once the video is loaded.
The code below is what I have so far. Essentially all I have managed to do is trace the name of the cuePoint. I believe what I need to do is somehow assign the cue point name to an object, pass that reference to the "fadeIn" function and run the "fadeIn" function.It is worth noting that the buttons I am fading in are already on the timeline, so I do not need to create them in code. I just need to reference them.
import fl.video.MetadataEvent;
import fl.transitions.Tween;
import fl.transitions.easing.*;[code].............
I have a function which contains some code and about half way through calls another function. Only problem is it stops the main function from running so the code following it snt executed. What I want to know is is there anyway to go back into the original function at the point at where I left and carry on executing? I've thought of one solution but its a bit long winded and I just wanted to know if there was a quick and easy method, before anyone asks the code needs to be in its current order.
View 3 RepliesIm pushing Point locations into an array to Shift em out later. like this:
tempmoves.push([new Point(roundx,roundy)]);
..
ob.movestoplayer = tempmoves;[code]....
What am i doing wrong?
It's been a long time since I've done any work with actionscript, and alas I've forgotten nearly everything. I've tried to look for a tutorial that would explain basic animation with actionscript, but the one that I found on Kirupa was no longer there.
Basically I'd like to do this:On the stage I have a movieclip and I'd like the movieclip to move along the x-axis to a certain point and then back to the starting point again. The moving speed of the movieclip should also be adjustable.
[Code]....
I'm basically having the following error: 1067: Implicit coercion of a value of type void to an unrelated type Array. In relation to the event listener that calls 'Backdrop'. Backdrop is a public function in another class, but it does still recognise Backdrop as a function.
var result:int;
if(observerButton.selected == true)
result = assignMemberAsObserverToEvent(dataGrid.selectedItem.id_event,dataGrid2.selectedItem.id_person,assignmentDescription.text);
else if(adminButton == true)
[code]...
There is error on two assign function calls.
The error is: Description Resource Path Location Type
1067: Implicit coercion of a value of type void to an unrelated type int. AssignUser.mxml /pui2/src line 149 Flex Problem
Here their declarations:
protected function assignMemberAsAdministratorToEvent(id_person:String, id_event:String, description:String):void
{
assignMemberAsAdministratorToEventResult.token = actions.assignMemberAsAdministratorToEvent(id_person, id_event, description);
[code]...
I'm creating a game in flash for a university project, and learning actionscript and programming as I go. I'm very much still at a beginner level - at the moment al I have is some actionscript for drawing rectangles and moving them about the screen. This is what I'm having trouble with at the moment: I have a class called 'Creature', and I want instances of it to interact with each other. I want them to do something when they come within a certain distance of another instance. And I want them to be able to pick a random other instance to get the location of, in order to do something with that information.
What I think I need is: A function for telling the distance between two (x,y) points.
A way of referencing the nearest other instance of the class. And a way of randomly selecting from all of the instances of the class.
How to convert 3d point to 2d point? I've found next formula in Internet(camera is situated in origin)
[Code]....
But these formulae give me strange result when z are less than zero(z<0) I need build line from A(100,100,100) to B (100,100;-100) As you can see these equations give really strange result when I try to convert B point in 2D dimension
i have the follow issue :
I have a point which is setted at the border on a component, with changed transform point to the center of a component in order to match the component rotation.
the important part is when i try to get the point XY after rotation - they remains the same as before rotation.
how to get XY, after rotation ( changeing point.rotation property to specific degrees of rotaion )
I am using AS2 with Flash 8 Professional So, my problem is that I currently have a man in the middle of the screen, who shoots a line towards the mouse when I click. However, when I use hitTest to see if the line collides with another object, Flash recognizes the line as a large box if it is diagonal, so the hitTest isn't very accurate. The line only satys there for one frame, so I can't have the usual moving-bullet-style. I am either looking for a way to create an imaginary line with AS from the starting point to the mouse and beyond, and tell whether or not this line intersects with an object... or some other way that I haven't thought of to fix my problem. Keep in mind that the line rotates from a center point towards anywhere around it for 360 degrees.
View 1 Repliesif i have a movieclip or a sprite could i find (via code) where is its registration point compared to its top left point (no rotation included) ?
View 4 Replies