ActionScript 2.0 :: Calling Function From Root That Is Defined In MC?

Jan 1, 2006

i've got this mc component i've created and reuse on some sites i've made. It's a real simple shoutbox that grabs info from a database using a php script.What i'd like to do is have this component refresh every 200 frames, which means, grab most current msgs and post them in the database.so for example, i have a movieclip called MC1. there's a function in MC1 that goes like: grabdata = function() {}; this basically calls the php scripts, loads the info, and so on.i wanna call this function from the root or even a parent MC.I have considered using prototypes or a class, but i dont think it's really necessary for something that seems basic enough.

View 1 Replies


Similar Posts:


ActionScript 2.0 :: Calling User Defined Function?

May 27, 2009

I am trying to load external swf's into my main swf through nested movieclips.Its like this: STAGE > contents_mc > loader_mc Also most of the code is from tutorial's out on the net.Content_mc I have the following MC's in content_mc (on 2 separate layers, if you want to know):

- Preloader_text (PText)
- loader_mc (LoaderExt)

[code]...

Problem: I am having a problem in calling the function ClipLoader and loading a clip through the loader_mc MovieClip (the text in Purple). The reason I am using this is eventually I will put in code in contents_mc to load various external swf per conditions i give.

View 7 Replies

ActionScript 3.0 :: OOP - Calling Function In Root?

Dec 23, 2009

This is kinda complicated, and I'm still trying to wrap my head around the whole concept of OOP. So right now I am building a XML Gallery, and in the FLA (Root) I've added the thumbnails. Everytime the thumbnails been clicked, it will bring up the "Detail" movieclip, which also is created in the root. And inside the Detail movieclip, I am creating a few buttons with an external class. My question is how can I call a function in the FLA (Root) when I click on the buttons inside the Detail movieclip? Note it seems I've successfully import my external class in both the root and the Detail movieclip.

View 7 Replies

ActionScript 3.0 :: Calling Function In Root Movieclip?

Apr 27, 2010

I've got a movieclip on the root of the stage called "bgImg", in that clip I've made this function:

Actionscript Code:[code]..........When you click a button in the nav it loads a movieclip to the stage from the library, inside this movieclip I have a row of buttons,when you click one of these I want to call the function in the movieclip on the root (ie. the function inside "bgImg" .

View 3 Replies

ActionScript 3.0 :: Nested Child Calling Root Parent Function ?

Jul 18, 2010

I'm switching from as2 to as3 and everything was going swimmingly with my new site until i tried to use a _root call to a function on the main timeline by a loaded movieClip that is loaded nested into 2 other movieclips. the movieClip needs to tell the _root when it's done playing so the root knows to load the next one in line through a php call. Everything works except for the _root call. In as3 there's no such thing as root anymore so I figured no big deal, i'll just find out what the new thing is and holy crap wtf! I can't figure this out!! I've read from doing stuff like custom eventLisnters (which i am trying now) and casting the root as a movieClip and then I read this whole crazy tutorial on building an event structure and the proper MVC way of coding and blah blah blah ALL I WANT TO DO is tell the _root that the loaded MC has reached the end of its timeline. Basically if it were as2 i could just go _root.loadNext(); and it would work.how to make a loaded MC talk to the _root timeline and call a funciton from there?

View 19 Replies

ActionScript 2.0 :: Calling A Function To Change Frames In A Mc On Root Timeline?

Sep 26, 2005

I have created a function on the root timeline, to be called at a certain point (when the character is on a certain frame and so is the certain item, he loses a life)the lives_mc advances frame by frame to show lives being lost.heres the function

Code:
function loseLife(){
if(_root.lives_mc._currentframe=1){
_root.lives_mc._currentframe=1[code].....

View 7 Replies

ActionScript 3.0 :: How To Target Variable Defined At Root

Jul 13, 2009

I want to find out the value of an index of an Array defined on the main timeline, from within a MC on the stage. In AS2.0 this would be as simple as trace(_root.mk_contArray[0]). In AS3.0, naturally something like trace(root.mk_contArray[0]) just doesn't work, nor any other variation I've tried. Is it something to do with addChild()? This instance is named, but I haven't used that method.

View 3 Replies

ActionScript 3.0 :: ReferenceError: Error #1065: Variable Root Is Not Defined?

May 12, 2010

It's an external AS file that I just converted from AS2 to AS3 and am getting this error -

Code:
ReferenceError: Error #1065: Variable root is not defined.
at LMS/getlasterrorLMS()
at LMS/initializeLMS()[code].....

View 6 Replies

ActionScript 3.0 :: Calling User-defined Functions?

Apr 22, 2011

I don't understand why within my function, initially the status of stage.scaleMode via a trace() is NO_SCALE, then it becomes SHOW_ALL.  The code below is found at three different location in my overall code.
 
stage.scaleMode = StageScaleMode.NO_SCALE;    backgroundPositioning(myStage.stageWidth, myStage.stageHeight);    stage.scaleMode = StageScaleMode.SHOW_ALL;

View 8 Replies

ActionScript 3.0 :: Calling An MC On Root Timeline From Inside Another MC?

Apr 12, 2010

how can I call an MC on root timeline from a button inside another MC?

View 1 Replies

ActionScript 3.0 :: Calling An Object From External To Root?

Sep 16, 2010

I have my main fla and then I have a actionscript named bullet.as.in the bullet.as I create a bullet using "this" throughout the script now how would I call the bullet on my main timeline?

View 3 Replies

ActionScript 2.0 :: Calling The Timelines Wrong With The Root Handlers?

Jan 26, 2004

I'm having a few problems with the php tutorial. I've got all the actions in my main timeline and calling them using instances. I have a mc called formset with an instance of formset in which is another mc called form with an instance of form which on the mc has the following code -

onClipEvent(data){
// show welcome screen
_root.formset.nextFrame();
}

I have a submit and back buttons with the following syntax -

formset.submit.submitbutton.onRelease = function(){
this.formset.form.loadVariables("email.php", "POST");[code]..........

I've a feeling I'm calling the timelines wrong with the root handlers etc.

View 1 Replies

ActionScript 3.0 :: Calling Root Object To Main Stage?

Feb 15, 2010

If I have a movieclip loaded with Loader and I want it to call back down to the movie that loaded it how do i do that? Referencing a root object just gets me to the root of the child not to the main stage.

View 1 Replies

Actionscript 3 :: Flash Run A Function Only If Instance Within Function Is Defined

Mar 3, 2011

I have a situation where, upon loading my swf, I add an event listener to the stage to listen for keyboard commands. One of them is to listen for the spacebar, and if it is pressed, it should play a movie. The problem is, that movie is not loaded until later on, depending other user interactions, therefore, until it is loaded, the reference to it would be undefined.

But if I wait and add the listener for key commands only when the movie is loaded, then I can't utilize the listener for other keyboard commands, like RIGHT or LEFT, which are the buttons which get you to the movie in the first place. Is there a way to add a conditional or something to prevent that code from being executed if the video is not defined yet? Here's my code:

[code]...

View 2 Replies

Arrays :: Flash - Defined Within A Function Discarded At The End Of The Function?

Jul 6, 2011

Curious question:Take this function:

function something():Array
{
var ar:Array = [];

[code]....

View 2 Replies

Actionscript 3 :: Calling A Method, Which Is Defined In Another Class, From Main Class Gives Error 1120?

Aug 16, 2010

I have two classes. The Main class calls a function, which is defined in a Second class.I'm getting the following error:Error 1120: Access of undefined property myFunctionBasically, I am creating buttons in the Main class that will add a corresponding Child to an Object in the Second class (if you click one button, child x1 will be added, if you click another button, child x2 will be added, and so forth).Here's the relevant code for the Main.as file:

package
{
import flash.display.MovieClip;

[code].....

View 3 Replies

Actionscript 3 :: Function Running Before Variables Are Defined?

Jun 15, 2010

I am trying to add an init() function to a MovieClip, but when I run the function from scene1 the variables that were set in the MovieClip are not defined yet... The MovieClip was dragged to the stage from the library.scene1:

mc.init(null);
MovieClip:
var _default = 5;

[code].....

View 1 Replies

ActionScript 3.0 :: Accessing Variables Defined In A Function?

Aug 10, 2009

I have been playing around with combining flash and PHP/Mysql for some time now, mainly sending one flash variable to a PHP file and then retrieving a result and turning it back into a different flash variable. My problem is i've got to the stage where I need to access these variables from other functions. Now I think I need to find some way of defining them outside of the function, maybe using global vars? Well i'm not gonna pretend I know anything about it. The two functions from which I access my PHP variables is as follows:

ActionScript Code:
function btnDown(event:MouseEvent):void {
var variables:URLVariables = new URLVariables();
var varSend:URLRequest = new URLRequest("http://localhost/test.php");

[Code]....

So I need a way to access the phpVar1 variable in a totally seperate function

View 6 Replies

ActionScript 3.0 :: Passing Instance In A Dynamically Defined Function

Feb 20, 2012

I'm trying to define this function so I can pass the CardButtons sprite to the Add Cards function. It "works" but there's one problem: the CardButtons sprite used in the function is determined by the value of i at the time of the function call (or in other words, the value of i when I click the sprite).
 
I want the sprite passed to be literally the value of CardButtons[i] at the point when the function was defined.
 
CardButtons[i].addEventListener(MouseEvent.CLICK, CardFunctions[i]= function(){ AddCards(CardButtons[i],PlayerHand[player-1][PlayerHand[player-1].len gth-1]);});
  
Is there a way I can do this, or is there a better way to do what I'm trying to do?
 
I guess for further example:
 
I want CardFunction[0] to store the AddCards function with the value of CardButtons[0] passed, it should NOT be dependent on the value of i.

View 3 Replies

JavaScript :: SWF Object - Play Song Function (Not Defined)

Sep 4, 2010

I'm trying to have JavaScript call a function from my ActionScript.

ActionScript:
import flash.external.ExternalInterface;
ExternalInterface.addCallback( "playSong", playSong );
function playSong():void {
var _sound:Sound = new Sound();
var _request = new URLRequest("music.mp3");
_sound.load(_request);
_sound.play();
}

JavaScript:
swfobject.embedSWF('[URL]', 'musicplayercontrol1', '1', '1', '9', null, null, {
allowScriptAccess: 'always', wmode: 'transparent' }, { }, function( e ) {
document.getElementById('musicplayercontrol1').playSong();
});

I keep getting a function not defined from firebug. I tried having the song play as soon as the swf load, and that works for sure.

View 1 Replies

ActionScript 2.0 :: Reffering To This From Function Defined Inside Class?

Jan 18, 2006

Code:
class className () {
//constructor
function className(targetmc,linkId) {

[code]....

My question is how can I set up an interval when I click on a button that is created from within the class.

I need my function updater to keep repeating untill I clear the interval.The only way I can figure out is to give the full path like this._parent._parent.instanceName.updater inside the setInterval, but although this works I think is just dumb to hardcode the instace name of the class. I could of course try to pass the instance name as a parameter, but I would really love to find out the smart way to do this (by the book).

View 3 Replies

ActionScript 3.0 :: Making Variables Defined In A Function Available Globally?

Jun 5, 2009

The following bit of code outputs that 'myRequest' and 'i' are not defined.

Code:
//Load external asset
function loadfail():void
{

[Code].....

after a bit of reading I find that it is because 'myRequest' and 'i' are defined within functions, and so those variables are not available outside those functions. How can I get around this? Make a class?

View 2 Replies

Actionscript 3 :: Calling MovieClip(root) From A Dynamic MovieClip Instance Produces Error 1034

Jan 14, 2012

For some reason, the same code works now, without any problem at all. I don't know what happened, or why, but I no longer have this problem Here's the original post: To put simply, I created a MovieClip, put it with addChild() to stage, and when I tried to call this piece of code:

[Code]...

View 2 Replies

ActionScript 3.0 :: 1061 Error (not Defined) When Call A Method Of A Self Defined Class

Feb 9, 2010

I am using flex builder 3.2, Action Script 3 and develop for Flash Player 10 and am quite new to it. when I call a method of a self defined class, I get the 1061 error (not defined). But the class and the method exist and are public, so what the hell am I doing wrong? Flash Builder is even offering me this method in the auto-completion, so at least the builder knows it... I have already tried cleaning the project (as this is the common source of strange errors when working with java/eclipse),

edit: solved... The problem was that a package had the same name as the variable I used for the class. Very strange error message, thumbs down for this .

View 0 Replies

ActionScript 2.0 :: Scope Concept: How To Call User-defined Function

Jul 15, 2009

i am quite newbie towards to actionscript 2.0 cos i am now learning on actionscript 2.0
here is the file attachment for you to check.Greetings.zipOutput cannot be worked.I am hoping to see the exact output:Greeting = Hello!Salutation = undefinedSubject: Brick Oven

View 2 Replies

ActionScript 2.0 :: Call A Function In Main Timeline And It's Defined In The Button?

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

ActionScript 2.0 :: Function Not Defined Immediately After Create MovieClip Instance

Jul 14, 2004

I create a new MovieClip, call it Somehow, and link it to the name "MyClip", for example.[code]...

They must be MovieClips, because the functions not only response with hello, like in the example.

So I want to create the Clip copies and call the functions in one step. This example is also not working when i put it inside of a onLoad, or onEnterFrame and so on.

View 5 Replies

Flash :: Calling OnLoadProgress Function From Inside Another Function?

Sep 23, 2011

I have an AS3 function that loads and audio file and then plays it. I have the pre-loader for the first audio file working - now I need to run the pre-load function before the 2nd audio file starts.

myMusic.addEventListener(ProgressEvent.PROGRESS, onLoadProgress2, false,0, true);
myMusic.addEventListener(Event.COMPLETE, playMusicNow, false, 0,true);
myMusic.load(soundFile, myContext); //This code works

[code].....

View 2 Replies

ActionScript 3.0 :: Calling A Function From A Private Static Function?

Feb 26, 2010

i'm trying to modify some code and can't figure out what the issue i'm having it. this is the(shortened) code:

public static function Lose():void {
trace("OVER!");
Clock.stop();[code]...

this is the error i get: 1180: Call to a possibly undefined method OverIt.i just want to call a function from inside of the public static funtion.both function are inside this class:

public class Game extends MovieClip {
}

View 4 Replies

ActionScript 2.0 :: OOP In Flash: Calling A Function W/in A Function Class?

May 12, 2004

Okay so I am reading through sens tutorial on OOP and updating my game that I am making. It is much easier to code this way (IMO) but still hitting snags.I am trying to get through this code:

[Code]...

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved