Call Function In Main Doc Class From External SWF?
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
Similar Posts:
Apr 1, 2011
I have a document class called Main.as In the class constructor I have the following listener:
enter code here
var listeningFORModeChangeToStudent:Sprite = new Sprite;
listeningFORModeChangeToStudent.addEventListener(TellAllModeChangeToStudent.STUDENT,exp);
addChild(listeningFORModeChangeToStudent);
[code]....
In a third class I make a call to the despatcher in the previous class:
enter code here
var ThisTellAllModeChangeToStudent:TellAllModeChangeToStudent = new TellAllModeChangeToStudent;
ThisTellAllModeChangeToStudent.tellAllModeChangeToStudent();
I have trace statements in eveything and from this I know the despatcher in TellAllModeChangeToStudent is being called.The problem is that the listener in the main.as is not calling the function exp.I cant see why and I dont know how to check if the listener is actually seeing the dispatch event?
View 1 Replies
Jun 23, 2010
I have one swf and this one load another one inside a MC on the stage.
Code:
function chama_movie(name:String) {
this.mcLoader.removeChild(carregador);
var carregador:Loader = new Loader();
[Code]....
View 7 Replies
Apr 30, 2010
I have 2 buttons in my main movieclip, one called "projects by client" and the other "projects by category".I have an external projects.swf which has 2 functions CLIENTS_CLICK and CATEGORIES_CLICK. The code is in the first frame of the projects.fla actions layer and not in a class.
View 1 Replies
Jun 3, 2009
How can a function in main timeline be called from class file?
View 4 Replies
Feb 24, 2011
i write a sound playback class that stop the older sound and play the new sound.After that i need an extra method in this class that trigger when the sound play is complete.I successfully achieve this, but i need to inform the main app (main.mxml) about the completion of that sound playing.
here is my sound playback class.
package com.m2b.data
{
import flash.events.Event;
import flash.media.Sound;
[Code]....
View 3 Replies
Feb 15, 2012
I have some functions defined at the main timeline, and I need to call them from a class, how can I do this?
I've tried object(parent).function();
and object(root).function();
but didn't worked
those functions need to be on the main timeline because they removeChild() of the class
View 2 Replies
May 15, 2010
I'm loading from my main page an external js file, with a function.
I have a flash file in the main page invoking the javascript function.
Everything worked very well until when the javascript code was in the main file, but when I moved javascript to an external file the function seems not called anymore.
So... there is no way to move the javascript code to an external file ? Or any other solution ?
[Code]...
View 3 Replies
Nov 16, 2010
I'm having some trouble finishing an interface i'm working on,the function indica() adds a menu listing of items (indicadores) inside a mask because its too large, and i added a scrollbar that allows to scroll through the items but now i need to add the buttons inside the movie clip indicative,i can add symbols and buttons, but i'm having trouble having them call functions inside the same class that the function indica() is running.[code]
View 2 Replies
Nov 20, 2008
I have a movieClip named MC, and it's enabled with action script, with the class name MC_Rectangle and a Stage.I override the MC_Rectangle class file in a mc_rectangle.as external file.here is the code:
package{
import flash.display.*;
import flash.events.*;[ code].....
I have new a object in the main stage var
mc_rect:MC_Rectangle = new MC_Rectangle()
in main stage:
1. how can i access the variable "sequence" in "mc_rect"
2. how can i pass parametre from main stage to mc_rect via function setSequence(data:int)?
3. how can i call the function in addSequence() in mc_rect.
in asp.net, i usually use mc_rect.sequenct,mc_rect.setSequence(data), mc_rect.addSequence() to achieve my goals......btw, can function in mc_rect return out result to main stage?
View 1 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
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
Feb 9, 2009
I'm quite confused about how to do it, look at this [code]...
View 2 Replies
Dec 15, 2009
how do use a function from a doc class.... to call a function to work on in
[Code]...
View 2 Replies
Aug 14, 2010
I need to run a function once a movieClip has stopped playing, but can't figure out how.
View 4 Replies
Dec 10, 2010
It's at the back of my head somewhere, but I can't figure it out.I have a dropdown menu movie clip I need to make _visible = false, but calling
PHP Code:
_root.dropdown._visible = false
from the external swf doesn't reach the main swf. How do I communicate commands from an externally loaded swf to the main swf? I tried _root and _level0 to no avail.
View 1 Replies
Oct 18, 2009
I have a button in a movieclip and im trying to tell it to call a function on the main timeline. How do I do this? root something?
Here is the function on the main timeline im trying to call
ActionScript Code:
function hallwaylurkerload (evt:MouseEvent):void {
var currentGalleryID:int = 1;
loader.load(new URLRequest(galleries[currentGalleryID][0]));
[Code].....
View 1 Replies
Aug 11, 2011
The Situation: I have a main.as that has a function that is worth 400 lines.
What I want to happen: I want that function to be loaded from another .as file so that my main.as does not look too long. Also, I have a lot of variables that was instantiated on my main.as that is called on that 400 line function.
The Question: How do I do this?
View 7 Replies
Jun 19, 2011
I have a function within another function. Is it possible to call the function inside the function from the main timeline. See example code. I want to call the function called sub from outside off the function called main.
Code:
function main():void{
// Do something
function sub():void{
//do something
}}
View 10 Replies
Apr 17, 2008
I've got a movie with a few buttons in it. When you click on one of the buttons an external swf opens. At the same time a large, quare, white movieclip opens at the back of the external swf (the white mc is in the main movie). Okay, so for so good.
In the external swf there is a close button. When you click the button, the external swf goes to frame 14 to show a short closing animation. The last frame contains the following code:
TweenLite.to(_level0.contentback_mc,1,{_alpha:0});
this.unloadMovie();
The first line is to make shure the large white mc becomes transparent again. The second line is - ofcourse - to unload the external swf.
The problem is that the first line doens't work. When I trace the first line from the main movie, the output contains '_level0.contentback_mc;
Oh, and the external swf is loaded in an actionscript generation container (contentback_mc).
View 1 Replies
Feb 2, 2012
I have to call a function that is defined on the main stage of my project, and I have to call it from a MovieClip
View 3 Replies
Aug 8, 2008
How can I run function of the main document class from a class of a MovieClip? I usually just used MovieClip(parent).function(), but now my MovieClip has another parent. Or what do I have to pass to the MovieClip class when creating the MovieClip to acess the main document class?
View 9 Replies
Nov 25, 2010
Lets say I have a Main Document Class called Main. I also have a child class called childClass that call a function from the Main class and is also imported in the Main class. How should I call the function? I tried this , but when calling the function, it's getting me error.
Main class :
Code:
package {
import flash.display.Sprite;
import com.childClass;
[Code].....
View 6 Replies
Apr 20, 2011
I have a Document class that instantiates a class named Other. I need to call a function in the Other class from the Document class.I'm getting this error: Call to a possibly undefined method OtherFunction through a reference with static type Other.I have read online that you need to use make the functions static or use a getter function but I'm unclear how to do that. I haven't been able to make it work and I feel like i'm missing something fundemental with this problem.below are simplified versions of the classes.
Document class
Code:
package {[code]......
View 1 Replies
Nov 21, 2009
I'm not sure that I'm on the right track here. I've got what is essentially a 'gateway' movieclip and depending on the CLICK a corresponding movieclip (form) is loaded -- these all being in their own AS file. There are multiple corresponding pages that will all load/close in their own fashion but the 'gateway' will reload in it's own function-- consequently, I have this function on the main_AS. Can I trigger this function from the sub class or do I need to move the 'reload' function to a 'reload' class.
View 2 Replies
Apr 17, 2012
I am using in AS3 "External Interface ". When I call the JS function that is on the same page as swf everything works fine.
I added a link in the html page to an external JS file, when I move the JS function to the external JS file the website crushes.
I would prefer to have all my JS functions on an external file so I can use them in the future in other project and it also makes it easier for me to update the site.
how to call a JS function that is on an external file from AS3?
View 6 Replies
Oct 6, 2010
How do I call a custom component's public function from the main app. For example, I've got a timer component, MyTimer.In the main app, I want to call startTimer() or stopTimer().In the main app, I've got:
<visualcomponent:MyTimer />
In the component, I've got:
public function startTimer():void {
[code].....
View 1 Replies
Sep 28, 2010
I have a main time line and a button defined. Can I define functions in actionscript anywhere and call them from anywhere? For example, if I call a function in main timeline and it's defined in the button, does that work?
View 3 Replies
Jan 21, 2006
How do you call a function on the main timeline from a an onRealease in a nested mc?I have created a function that resides on the main timline, and when a button is released I want to call it, but the button is nested in a movie clip.
View 2 Replies
Jan 29, 2007
I am working on AS3 and I have a created a button class which have an off state and on state. I did the class and it works fine, but i need a little fine tuning. Right now I am polling the button state from the root(main timeline) by checking a boolean property in the button class. I feel it is quite inefficient to check the button state on every enterFrame event of the main timeline. Rather I would prefer the button to tell the root time line by invoking a function written in the root, whenever a state change occurs. t should be cleaner , right?? But when I try to access a function in the root which goes like this
[Code]...
View 14 Replies