AS3 - Function In Imported Class Not Being Called
Dec 28, 2011
mainClass.as
package {
import mfClass.CarSelector;
import flash.display.MovieClip;
import flash.events.Event;
public class MainClass extends MovieClip {
[Code] .....
Now, when I run this in flash. I get this message.. in output.
TypeError: Error #1006: sel_Fun is not a function.
at MainClass/show_selector()
at MainClass()
View 1 Replies
Similar Posts:
Apr 16, 2010
I am working on a Flex Front End at the moment, and have been using the Parsley framework for passing messages/events around.
I was wondering if there is a simple way for a function (in this case, an event's constructor) to obtain a reference to the object which called it?
This is to ensure that a certain event that I am defining can only be dispatched by one specified class. My thinking is to check the caller of the constructor somehow, and throw an error if it is not of the correct type.
View 2 Replies
Mar 9, 2010
i got a class(class1) that extends another class (class2)...when something happens in super class, i need to update the class1, soi need to trigger a function in class1 from class2... I know is bad programming, but is that possible? I'm confused
View 0 Replies
Jan 27, 2009
I've been sorting through the XML docs and i've bumped my head into a bit of a question. So, to preface, I have been able to load the XML successfully, but I want to be able to use my own XML loader class to load the XML and then be able to reference it from the document class. Also, I'd like to be able to send a file path to the loader class when I call it.
The document class:
ActionScript Code:
package rg.sites{
// flash classes
[code]....
View 8 Replies
Jul 15, 2011
I have the following parent class that I'm working with:
Code:
package {
import com.poptent.SubClassOne;
import com.poptent.SubClassTwo;
[Code].....
I am trying to set it up so that a parent method called by subClassOneInstance can affect subClassTwoInstance.
View 4 Replies
Aug 17, 2010
I'm just now learning the new object oriented way of scripting. It's been a wild ride, but I've finally learned how to keep script off my frames (very hard coming from as2).Here's my problem:
I have a TextField on the stage in my main .fla file named loadPercent.
I'm loading a jpg with preLoad.as and displaying the bytes loaded in loadPercent.
I can access my loadPercent TextField from my MainClass
but I can't access it from preLoad.as
the document class is MainClass.as
Code:
package
{
import flash.display.MovieClip;[code]....
I get three '#1120 access of undefined propery' errors for each time i try to access loadPercent.
a few basic questions: 1. all my files are in a folder in my documents, not in the flash directory, is this bad? I've seen people using com.whatever etc.
2. my main .fla file does not share the same name as my MainClass.as (it's not named MainClass.fla) Is that a problem?
I'm assuming these are inconsequential because my code seems to work up to a certain point.
View 7 Replies
Oct 23, 2009
My following document class is working fine. But, when I want to import it instead of using as a document class, it reports an error "1067: Implicit coercion of a value of type Class to an unrelated type flash.display:DisplayObject.". My class code is here:
package{ import flash.display.Sprite; import flash.display.Shape; import flash.text.TextField; import flash.events.MouseEvent; public class Shapes extends Sprite { var square: Sprite = new Sprite(); var txt: TextField = new TextField(); public
[code].......
View 2 Replies
Jun 29, 2010
Use Flash CS5 (and AIR, though this does not seem like it would be AIR related) in Win XP 64 I have a MovieClip symbol in my library with the identifier 'Puzzle10Piece10' with the following actionscript attached to frame 1 of the only layer with the following actionscript:
[Code]...
This runs contrary to my understanding of the pre-compiler and code execution order. In my way of thinking, any reference creation and related memory allocation is made when the object is instantiated, and indeed that allocation, unlike C depends not on code order (declaration before use), though this is an order that would satisfy even the C pre-compiler. If I understand the Flash compiler at all, it's not even a question of 'code order'... the symbol is pre-compiled such that for it to exist... for it to be instantiated, the variable would exist before the function would even be 'available' to be called internally or externally. Is my thinking way off, or is this a bug?
View 6 Replies
Jan 10, 2012
I have an AS3 program that calls a function multiple times. The function must return multiple variables, so I created a class for the function to declare an object containing all of these variables. For example, here's my class:
package
{
public class PER
{
[Code].....
Let's say the calling program calls the function, which returns the variables into data_set1 (where data_set1 depends on input variables arg1, arg2, arg3) using:
var data_set1:PER = function_name(arg1, arg2, arg3);
The calling program does some stuff, then calls the function again, but returns the variables into a new variable name, data_set2:
var data_set2:PER = function_name(arg4, arg5, arg6);
My intention is that data_set1 and data_set2 are different (e.g. not linked together).
My question is, given that arrays are passed by reference, will data_set1 be modified to agree with data_set2 upon the 2nd function call? Why or why not?
View 1 Replies
Feb 14, 2011
i) Create a symbol called SimpleSquare. This should consist of a simple red square graphic
ii) Create a class file to define a class called SimpleSquare. This should be linked to the SimpleSquare symbol. SimpleSquare ashould have the following functionality: When the instance is placed on the Stage, it should start to disappear by decreasing its alpha at 0.01 in every frame (hint: alpha)
View 1 Replies
Aug 4, 2010
I'm using an AMF service that was built by someone else. Basically what happens is that some info is passed to the AMF service and it returns true or false.I want to be able to pass in various info to the a function that calls the AMF service(submitTracking) and then get the true or false value returned in onResultSubmit to be passed back to submitTracking.
var screen:String;
var buttonnumber:String;
function submitTracking(screen:String, buttonnumber:String) {
[code]....
View 3 Replies
Dec 30, 2009
I have an FLA in which there are a number of MovieClips in its library. I also have a document class for this FLA, which I will refer to as Body.as from here out.From Body.as, I call other classes designed to put stuff together and allow for organization due to large amount of MCs I have to use in the FLA. For reference, these classes are called as such: Head.as, Chest.as, Arms.as, etc etc.Now, where Body.as is the document class, and is therefore functioning to operate all areas in the FLA, I wanted to use these additional class files to be used to manage anything related to them, including any MCs I have. I'll use Head.as for explaining. To that end, I have four MCs, each named as follows:hat1hat2hathat4s part of trying to organize it all, I want to be able to call a singular function in Head.as that will retrieve these MovieClips and add them to the stage (Or, as I hope to do once I get a bit further in, add them to a larger MC that will then be added to the stage).
View 9 Replies
Jun 9, 2010
I'm using a flex component that use a to load a .swf file.
The loaded .swf
- is passed to me as is and I can't edit
- it has some as3 functions in it
Is it possible in the "parent" application (the one with ) to override functions included in the "child" swf (the imported one)?
View 1 Replies
Oct 8, 2009
I've been banging my head against the wall with this one. I have the following set function in Flex. [code]If I set the periodChangeAmount to -1 or 1 the set method gets fired. If I set it to zero it doesn't get fired. What's the deal? Does anyone know why it wouldn't get called when setting it to zero. If I change the object type to a number or even an object it still doesn't work as expected.
View 2 Replies
May 11, 2011
I have this script for random letter cycling below. I want to call this function to happen at a certain click or frame label, but when I call it with tweenmax, I get a runtime error. Can anyone explain to me how to call this function at certain events. I know this is definitely not best practice but have to try somewhere and here is what I did:
var targetWord:String = 'home';
var wordSoFar:String = '';[code]....
View 1 Replies
Mar 9, 2009
I am loading one xml file and onload (or onData) of this file I am calling another function but, this function is not getting called. What can be the issue? Can delegates be used here and how?
Here is the code for reference
Code:
//path for _global.bookXML is defined already.
_global.book_xml = new XML();
_global.book_xml.ignoreWhite = true;
[Code]....
View 2 Replies
Sep 14, 2011
I have imported a SWC into my actionscript project. It includes many different movieclips that I can access in my project. My question is this: How can I create a custom AS3 class that I can use to add functions and properties to my movieclips?
For example I have a movieclip with a linkage name of LevelButton. I tried creating a class that was the same name but they didn't seem to go together.
View 2 Replies
Nov 29, 2009
My project imports a custom class with a function called at runtime that creates a textField.
I want to be able to change the x and y coordinates of this textField [tf.x and tf.y in the class] from within the parent movie (not the class itself) but am having trouble.[code]...
View 5 Replies
Jan 30, 2011
I have an on enter frame listener defined in a function:
Code:
function sideClicked(e:MouseEvent):void {
removeEventListener(Event.ENTER_FRAME, loop);
var targetName=e.target.name;
var a:Array=[];[Code] .....
The looptoposition() function simple calls a function from a custom class repetitively to move an object until it reaches its position. This is the function it calls from the included custom class:
Code:
public function rotateToPos(a:Number,b:Number,c:Number):void {
if(!cubeReady){return;}
if(cube.rotationY<b){
cube.rotationY+=3;
[Code] .....
This gets the desired result visually - the cube rotates until the chosen point and then stops - however the listener continues. I have two problems:
1) I would like to remove the listener but can't seem to do so from the imported class - I'm having trouble referencing my functions in the root flash file.
2) I also need to declare that the function has completed - but the equalities mean that b is either greater or less than but never equal to? Whats a better way of getting the cube to rotate to a set position on each frame? The reason for the equalities are the cube can turn two different directions. So rotation could be negative.
View 7 Replies
Jun 1, 2010
I have a AS2 script to get information from a MySQL database. This information is a text from 0 to 300 chars. I want to display that text in this layout: I want to resize the black box you see on the picture in function of the amount of text imported.
The instance name of the box is: cargador.fondo (only want to resize height)
The instance name of the text is: cargador.texto
View 1 Replies
Oct 7, 2010
I've got a main.fla which has a main.as file included within various functions in the fla. Then I have external.swf being called in, which have external.as files that need to call on a function within the main.as file.Ultimately, the "next" button is supposed to be unclickable until the external swf has completed, then it glows and lets you click then turns off again. Problem is, as it stands the "next" button never turns on because function's not being properly called.Here's the code, trimmed down to the essentials.know what I'm doing wrong here.main.fla
Code:
function external1(e:MouseEvent) {
gotoAndStop("external1");
[code]...
View 2 Replies
Jan 21, 2009
The code that is commented out will work, however, I'm trying to turn that code, since it's used multiple times, into a function.
Why isn't my function working when it's being called?
ActionScript Code:
function displayInfo(_ROLL:MovieClip,_MC:MovieClip, _NN:MovieClip) {
_ROLL.onRollOver = function() {
[Code]......
View 9 Replies
Jul 10, 2009
I've got a function 'fullReset' which resets the stage and places several movieclips (which are balls) back to a starting area. Within this function is a call to the 'unlockBallfunction within the Ball class (see bottom of code below).
ActionScript Code:
private function fullReset(event:Event):void
trace("RESET BUTTON HIT");
[code].....
View 1 Replies
May 20, 2011
i have written one simple function, Now i want to do something like that:
Code:
if(function is called)
{
do something
}
so what will be the syntax for it?
View 4 Replies
Feb 25, 2009
In the game I am building I need every 5 seconds a function to be called. The function looks like the following:[code]How would I go about making a time that pretty much counts to 5 and then resets itself again?
View 5 Replies
Mar 29, 2007
I stumbled upon this while trying to customize the tree component following the example on the LiveDocs, see [URL].. To see the problem, do the following:
PART 1:
1) create an empty test.fla file
2) put a tree component on the stage
3) convert it to a symbol named TreeNavMenu, export for
Actionscript as TreeNavMenu
[Code]...
View 1 Replies
May 22, 2009
This is probably ueber basic, but I don't know how to do it. I am importing tweenlite on the root timeline like this: import gs.TweenLite;
I now want animate things in other MCs. I tried something like this, but it did not seem to work.parent.TweenLite.to(text1, 3, {_alpha:100, overwrite:0});
View 5 Replies
Jun 8, 2010
I'm trying to make methods available like so:
ActionScript Code:
MyClass.myFunc();
Instead of
ActionScript Code:
var myVar:MyClass = new MyClass();
myVar.myFunc();
I know that to do so I need to declare the functions/variables/constants as static:
ActionScript Code:
package MyPackage {
public class MyClass extends Object {
public static function myFunc():void {
} public function MyClass() {
[Code] .....
When I try to access the static function through the full reference (i.e trace(MyPackage.MyClass.myFunc);), it works, while trace(MyClass.myFunc); returns undefined. This contradicts what I've read in tutorials and posts on the Internet. They all use the short syntax, not the full path.
View 9 Replies
Aug 11, 2009
I tried to search for this but the search wasn't working. I have a loder class where i load in some xml. This is the function that's called after the xml is loaded[code]...
The xml traces out fine. My question is how do I define var xml so that I can access it from outside of the class in another class or from the timeline?
View 1 Replies
Jan 4, 2011
I have a very simple flash program code in AS3, inside this program there is a dynamic textfield html capable. Also i have a database were i will put some information.Each element in the database can be linked to other. For example, this database will contain tourist spots, and they can be related with others in the same database.This interesting spot is near <link to="ramdo2">ramdom place2</link>. And so, so so..The information in the database is retrived by the flash application and it shows the text on the dynamic textfield. I need somehow to tell my flash application that have to be a link to other part of the database, so when the user click the link a function in flash call this new data.The database is a simple Mysql server, and the data is not yet in there, waiting for your suggestions of how to format it and develop the solution.Im a php developer too, so i can make a gateway in PHP to read the MySQL and then retrive some format to flash, an XML for example.
View 3 Replies