ActionScript 3.0 :: Instantiating Class From External Function?
Nov 11, 2010
I've got a confusing situation which wont seem to fix itself basically I have my main class, my iContent class (which will hold each page and have functions for all pages), and my individual pages.
The homepage is instantiated by calling the iContentClass.goHome method in the main document class. The home page contains a button to go on to the next page. This button references the goColourBrowserPage function within the iContentClass, which removes the child (being the home page) and attempts to add a child (colourBrowserPage).
For some reason this doesnt work! It doesnt seem to add the child and wont let me remove the child of the home page! I've been sitting here for 3 hours trying to work it but to no avail!
[Code]...
View 1 Replies
Similar Posts:
Feb 18, 2007
I am having a problem instantiating a Character class inside of a game class.I am working on converting URL...l these tutorials to A.S. 2.0.[code]
View 2 Replies
Jul 9, 2010
I am trying to use AMF PHP to pass variables to a flash file, thus far I cannot see anything wrong with my code, but I have very little experience with creating classes, so here it goes, here is my code,
index.php:
<?php
include "amfphp/services/flashMe.php";
$session = true;
[Code].....
Flash is looking for the flashMe class and the push method within that class, but I keep getting null variables in my flash file when I run it
View 3 Replies
Jan 28, 2010
My Class B imports Class A.Class A is associated to an FLA. This FLA has a moviclip (MC) in its library.Now I need to dynamically instantiate that movieclip MC from Class B. How can I do that??
View 9 Replies
Nov 16, 2010
Code:
var myOnStageClip:MovieClip = this.fileInstanceMC;
var myLinkage:Class = Class(getDefinitionByName(getQualifiedClassName(myOnStageClip)));
[code].....
View 5 Replies
Aug 4, 2011
I'm looking to load external .swfs that have graphical assets in them which are all 'exported for actionscript', and instantiate those assets in a .swf packaged for iOS. I'm using the adt command line packager to create the .ipa file. I'm including the .swf files while packaging. The .swf files seem to load correctly, and give me no errors, but when the Loader for each .swf's bytesLoaded equals bytesTotal the content property remains null.The program works perfectly when I package the .ipa using the -target ipa-test-interpreter flag, but not when I use the -target ipa-test.
I'm assuming the problem is that iOS doesn't allow Flex developers to load external .swf files that contain actionscript, and the 'export for actionscript' in the external .swf files counts as actionscript for the purposes of Apple's security policies. I'm looking for confirmation as to whether or not this is the problem.When using adt to package .ipa files, does iOS block external .swf files that have library assets that have been 'exported for actionscript'? [URL]
View 1 Replies
Jan 15, 2009
How do you instantiate an MC that resides in an external swf library?
So for instance loading "shape.swf" and instantiating "square_mc" from it's library onto the parent stage.
View 8 Replies
Dec 30, 2008
When I set the following class as my document class it works (draws a rectangle) but when I don't set it as my document class and instead instantiate it using var myRec:simple_shape = new simple_shape(); in first frame of my timeline nothing happens no rectangle and no error either). why and how I can get it to work without setting it as my document class?
[Code]...
View 6 Replies
Oct 28, 2009
I asked yesterday how to call a function from an XML file, and I figured out how to make that work using the string-to-function call.so in my XML file I have <ITEM CALLBACK="ContactsList">View All</ITEM>, and my TextMenu class parses the XML file and creates my navigatable text menu instance. When enterMenu():String is called, it looks to see if the CALLBACK attribute has a value, and if so it returns it as a String.so..
var callbackFnc:String = textMenu.enterMenu();
if(callbackFnc != null)
{
[code].....
View 2 Replies
May 3, 2010
I am loading one swf into another using the Loader class, but when the child swf finishes loading and is added to the display list, its Document Class is not instantiated. I have a few trace statements that should execute when the object is created, but nothing is happening when loaded into the parent SWF. When I compile the child SWF on its own, the Document Class runs as expected.
So I'm wondering... how do I associate a child SWF's Document Class with Loader.content?
[Code]...
View 3 Replies
Sep 26, 2011
Is there a way I can load a swf file but not automatically instantiate it's DocumentClass? Instead I want to do something like the following:
protected function mainLoaded(e:Event = null):void {
trace('mainLoaded');
var main:* = this.mainLoad.createClassByName('Main');
trace(main);
}
Where mainLoad is an instance of CasaLib's SwfLoad and createClassByName is the equivalent to
loaderInfo.applicationDomain.getDefinition();
The thing is that when my swf finishes loading I can see it is created, because of some trace calls, although its obviously not added to the display list.
View 1 Replies
Jan 14, 2009
Here is the code:
ActionScript Code:
private class someFunction(classRef:Class):void
{
try
{
var instance:Object = new classRef();
[Code]...
Can I perform the check without instantiating?
View 1 Replies
Jan 17, 2009
I have a weird issue with actionscript 3.0 and I wanted to see if anyone knows what might be going on.I create a UILoader in the root layer. Then on a button click, I set it's properties and once it's loaded, I set the size and all that. It works fine.Then I try to instantiate the UILoader in the button click method and the picture loads up enormous. It never happens when I instantiate the root layer. It always happens when I instantiate it in the button click method.The code is below. Does anyone know why it would do this? I traced all the properties I could think of (xscale, yscale, height, width for both the containing movieclip and the UILoader and they are the same regardless of where it's instantiated
var myStage:MovieClip = new MovieClip();
var stageItem:UILoader = new UILoader();
//Button click function
[code].....
View 2 Replies
Aug 3, 2010
Is there a way to declare and instantiate an array using constants as indexes? I want to do something like:
public var arr:Array = new Array([ CONSTANT_A : "helloWorld", CONSTANT_B : "helloGoodbye" ]);
In php one could do:
$arr = array(CONSTANT_A => "foo", CONSTANT_B => "bar");
View 9 Replies
Nov 29, 2010
I'm making an app with pages set out as classes which extend the MovieClip class.
What I've got are back buttons and different pages which go to the same page, however... If I end up going out of a page and back into a page (specifically one with drawn squares and dynamic text boxes called from a web service), it seems to have kept all of the original information.
So far I've tried killing all of the children with a while loop targeting the index and also using weak event listeners - neither is working!
View 2 Replies
Jan 27, 2010
If I only instantiate a class once should I make its vars static? I understand how this is of benefit if I make multiple classes, clearly you use less memory as it creates a reference to the same place for each class. Are there any other benefits for creating static vars or functions ?
For example I have my class 'MainMenu' which I create once (might even be my document class). In it I create a
Code:
private var someHolderForStuff:Sprite = new Sprite();
Should I rather create
Code:
private static var someHolderForStuff:Sprite = new Sprite();
View 2 Replies
Jun 8, 2010
I have a MovieClip symbol that has 2 frames (for now). Depending on how it was initilialized, I want it to gotoAndStop at either frame or 2.Inside my class definition (Animal.as), I have written this as my constructor:
var type:String;
public function Animal(t:String = "") {
type = t;
[code]....
View 2 Replies
Oct 22, 2011
I am trying to access a function in a loaded swf that has external class.. I would like to avoid having to put the function on my "Main" Doc class in the external swf and instead access the function directly from the class
This is what ive tried so far and it's a no dice:
private function startLoad(){
var loader:Loader = new Loader();
var req:URLRequest = new URLRequest("one.swf");
[Code]....
View 1 Replies
Jan 9, 2012
Let's say I have a defined ClassA. ClassB extends ClassA and there's a Movie Clip instance on the stage linked to ClassB. How would ClassC access the properties and methods of ClassB without extending ClassB or creating a new instance of ClassB? The way I'm currently doing it is by referencing the stage instance linked to ClassB and then using the dot syntax to access ClassB instance variables, and this works only if the the accessed variables are public or internal, depending on what package ClassC is part of. I would like to know if there's a better, cleaner way to accomplish this.
[Code]....
View 2 Replies
Mar 17, 2011
I'm having this problem: I have an external fla (Dawn.as) and I want to instantiate the class from the external file into the main swf timeline, but when I try doing that I get an error:
ActionScript Code:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at Code::Chapter/initialise()
[code].....
View 5 Replies
Apr 25, 2009
've tried calling constructor class from my main.fla, and it just doesn't work. The error when I try to instantiate the constructor is that it needs an argument... and since the class extends a Sprite.
PHP Code:
public functionportGal():void {
this._images = new Array();
[code].....
View 3 Replies
Dec 30, 2007
I am trying to set up a script that will generate a matrix repeating the same symbol X by Y times. For example, b(3,2); should generate...
OOO
OOO
...and after many days of being tested by this problem I have narrowed the location of my problem down to what can be seen up in the following.
Code:
for (a=0; a<4; a++){
for (b=0; b<4; b++){
var z:Number = ((a*4)+b);
_root.attachMovie("Light", ("L" + z), _root.getNextHightestDepth(), {_x:(a*45), _y:(b*45)});
}
}
For some reason, that loop will only attach one copy of my "Light" movie. I cannot seem to figure out why more are not added. I am putting that code on the first frame of my movie. There is nothing else in my project yet.
I have compared my array to [URL]
View 1 Replies
Aug 19, 2010
I have a symbol named picHolder. In symbol properties under linkage, I chose "Export for ActionScript" and "Export in frame 1" and gave it a class name of picHolder.Normally, to instantiate a new instance, I'd say:
Code:
var tempPic:picHolder = new picHolder();
and I'd go about my way.
[code].....
View 1 Replies
Jul 9, 2009
I have a main.swf that loads in an external swf called home.swf. I want to be able to call a function in main.swf's doc class from the loaded swf:
Code:
function loadArtist():void { // my function }
in the main timeline of home.swf I'm calling it this way:
Code:
function timeToGo(m:MouseEvent):void {
trace("button pressed");
MovieClip(this.parent.parent).loadArtist(); }
the home.swf compiles fine but when loaded in the main.swf & the button is pressed i get this error:
TypeError: Error #1006: loadArtist is not a function.
at home_fla::MainTimeline/timeToGo()
It seems that it thinks loadArtist is a property. Ack. I've got 3 objects loaded dynamically using addChildAt(mc, 0) ...
View 2 Replies
Mar 24, 2010
I'm trying to load an external swf into another swf and acces some variables and functions. This actually works quite well, however I'm dealing with some variables from the external loaded swf that are read-only.I'm wondering if I could somehow change the variable to be writeable as well by extending a function from the loaded swf.Maybe there's also another way to change the read-only variable, but I have no clue.I know all the variables, functions and class names from the loaded swf, I just can't change them myself, I have to do it by loading the swf externally.The class from the external swf is called "Application" where I want to change the "public const DEV_SERVER_URL:String" to another string, or extend the function: "private function get serverUrl()" returning a string.[code]
View 1 Replies
Jul 15, 2011
I am creating a side scrolling game in Flash (as3) and trying to keep things organized and clean.Ive created a "Level" class that gets all the level data, player data, and creates all the terrain objects and the player object. Its starting to get messy because im handlng all of the functions for player collision checks and player movement, terrain movement, sound starting and stopping, enemies, and more, all in this class. Is this normal? Or is there a better way to organize things to keep them separate, but still allow them to interact with each other.
View 2 Replies
Aug 1, 2011
i want to call an external function inside a class. thats the code;
in checkConnectionStatus function,
this[_funcNameForSucceededCon].apply(); doesnt work because "this" is the class, not the Application. How can i reach Application at this time or what can i do?
package myLibrary
{
import air.net.URLMonitor;
import flash.events.Event;
[Code]....
View 1 Replies
Feb 9, 2009
I'm quite confused about how to do it, look at this [code]...
View 2 Replies
Jul 29, 2008
I'm using a class that I converted from AS2 to AS3 using Patrick Mineault's converter: [URL]
The original AS2 class:
Code:
/**
* Colour handling routines
* Culled from many places:
* - http://www.actionscript.org/forums/s...d.php3?t=15155
[Code]....
Is the AS2 to AS3 conversion part of the problem (aside from my ignorance of how to use it)?
View 3 Replies
Jan 30, 2010
For some reason I cant figure this out,I have a function thats in a method in a class..I have a second method in the same class, trying to call the function from the second methodeg:
Code:
package com.sarin
{
[code].....
View 4 Replies