ActionScript 2.0 :: Calling Function From AttachMovie?
Aug 4, 2005
I have a button and when you press it it attaches a MC and calls a other function called showProductInfo().
Code:
_root["pod"+i].sub.pinfo.onRelease = function(){
_root.attachMovie("popup", "popuper", i);
_root.popuper.showInfo(i);
}
And in the popop/popuper MC I have the function showInfo(id) in the first frame. But I can't get it to work.
Code:
function showInfo(id){
this.txt.text = id;
}
View 8 Replies
Similar Posts:
Apr 10, 2010
I have 2 nested move clips in this order.
mc_a (grand parent)
mc_b (parent)
[Code]....
Now, I have a button on the stage. I am trying to load mc_a on stage using the linkage, and trying to load an image that replaces c_inst.
I am using:
on(release)
{
_root.attachMovie("a_call", "a_called", 1)
_root.loadMovie("image1.jpg", _root.a_called.b_inst.c_inst)
}
But so far it only attaches the movie, doesn't load the image.
View 1 Replies
Apr 18, 2010
I am trying to attachMovie from array.
Here it goes like this:
var __reg3 = new Array ("1", "2", "3", "4");
_root.p1.attachMovie(__reg3[0] + 1, "run1", 1); -- Not working
Then I tried using string:
[Code]...
View 3 Replies
Apr 17, 2010
I am trying to attachMovie from array.
Here it goes like this:
----------------------
var __reg3 = new Array ("1", "2", "3", "4");
_root.p1.attachMovie(__reg3[0] + 1, "run1", 1); -- Not working
Then I tried using string:
test1:String = __reg3[0] + 1
_root.p1.attachMovie('"+'test1+'"', "run1", 1); -- Not working
Then I tried this
_root.p1.attachMovie(" "" +test1+" "", "run1", 1); -- Not working
Then used this:
qt:String = '"';
_root.p1.attachMovie(qt+test1+qt, "run1", 1); -- Not working
But when I use like this, its working:
_root.p1.attachMovie("3", "run1", 1); -- working.
View 1 Replies
Oct 5, 2009
I can't seem to get the hitTest to work for my script shown below. I have tested using movieclips created on stage during design time and made to collide during run-time. hitTest works fine in this situation.
But if I use the attachmovie command and create a movie on stage during run-time, that clip cannot hitTest with other movieclips. The hitTest simply doesn't work.
The script below is basically, to create instances of enemymc, and it will fall vertically, hitting a movieclip target_mc which is placed during design-time.
var enemyTime:Number = 0;
var enemyLimit:Number = 20;
onEnterFrame = function()
{
[Code].....
View 3 Replies
Apr 28, 2008
I have a function on my script that attaches a movieclip on a specific position and then it duplicates it several times. This movieclip has a code in order to move across the stage randomly. When I try to use SetInterval to repeat this function two weird things happen: the movieclips don't duplicate over that specific location (they appear on x=0,y=0) and if I set the location only one duplicates and the rest don't. My question is: what can I do to repeat the function every 2 seconds exactly as it is the first time it runs, without the objects not duplicating or moving from the original location?
Here's the code:
meteoros = function () {
this.attachMovie("asteroid","asteroid_mc",this.get NextHighestDepth());
[code].....
View 2 Replies
Jul 10, 2008
I am currently developing an interactive location map of the UK for a client. Every region of the map is a button that, when click, zooms in towards the viewer whilst all the others fade in the background.This i can do fine with a single function. However the movieClip that is loaded with attachMovie contains buttons that I simply cannot target for any other function. I believe it is something to do with the attachMovie ObjName not being accessible outside of the function they're created in. I have been trying _global variables but still I cannot assign actions to the buttons.
when I click any of the buttons in the attachMovie I at least get a trace function to work.I have attached my complete actionscript but the section I'm struggling with is displayed below.
Code:
//zoom in
function focus (target_mc:MovieClip, scale_mc:Number, sec:Number, target_x:Number, target_y:Number, focus_mc:String) {[code]......
View 2 Replies
Aug 4, 2011
I have multiple movieclips (ml1, ml2, ml3 and ml4) to which I attach various clips out of the library to. Each movieclip uses a switch statemtent then attaches the appropriate movieclip from the library... so I got thinking, why can't I do a function rather than all this scripting? And I must have had a really long weekend because whatever I try just isn't working. Here's my code at the moment....
Code:
switch (supp1) {
case "bu" :
[code].....
View 2 Replies
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
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
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
Feb 10, 2009
The lineholder code below draws tickers on an axis for every 12th data point. It should also attach a year label every 12th data point. For this I have tried to use attachMovie. I've used it before and it's worked fine, but this code draws the line and omits the label (gives no error).
Code:
for (var a:Number = startPoint; a<_root.dataPoints[0].length; a++) {
if (b==12) {
//should attach date label
var myYear:MovieClip = _root.attachMovie("mc_dateLabel","mc_"+a,_root.getNextHighestDepth(),{_x:500, _y:300});
[Code] .....
View 1 Replies
May 15, 2008
I'm making a gallery using XML data and loading the information into a mc instance that are in turn being attached to the stage via linkage id. My question is this: I need to make all of those instances fade out with a function, and I have created a for loop to do this, however it is not working.. Any suggestions on how to make it work?
[Code]...
View 2 Replies
Dec 8, 2009
function test1():void
{
function test2():void {..}
[code].....
View 6 Replies
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
Mar 23, 2010
how can i call a function that is inside another function.like:
Code:
function abc() {function uvw() {
}
function xyz() {[code].....
View 3 Replies
Oct 9, 2010
I'm trying to get this one function to be able to call many functions (not at once, but call many possible ones)In other words, I'm trying to get this variable to be named as a function. That way, this one variable can create multiple functions.example:
actionscript Code:
class Thing extends MovieClip{ var funcvar; var othervar; function onLoad() funcvar = "YYY"; othervar = "ZZZ"; function onEnterFrame()
[code].....
View 1 Replies
Mar 8, 2010
I hope that this is possible. I can't seem to find any info on it on the web. I need to call a function from within a function. I'm not sure if there is a name for doing this that I don't know of?This is some example code of what I'm trying to achieve:
Actionscript Code:
someTimer.addEventListener(TimerEvent.TIMER, functionWithin);function mainFunction():void{ function functionWithin():void }}
[code]....
View 3 Replies
Sep 11, 2009
how can i open "insider" function from "start_function"?
ActionScript Code:
start_function();
function start_function():void {
[code].....
View 3 Replies
Sep 25, 2009
I read online, and I understand kinda what the error is stating. Though, I can't find out why.So basically what I understand is that I am calling a function that is not a function?ere is the error and code portions that are required.TypeError: Error #1006: value is not a function.at VideoPlayer_fla::MainTimeline/startVideoPlayer()at VideoPlayer_fla::MainTimeline/frame1()
View 2 Replies
Jul 8, 2010
I am refactoring some code. I have a PHP page that contains a MySQL query and stores the result in a PHP variable $my_result. This result is then echoed to a Flash SWF during embedding with SWFObject. I now want to call this PHP page that makes the query from a javascript function like so - one change I have made to the PHP is that instead of storing the result in a variable $my_result I am echoing the result. Javascript function to call the PHP page and make the database query
[Code]....
View 2 Replies
Jan 7, 2012
I am making a character walk. This code will make him wobble to the right and when thats done it will trigger him to wobble to the left and then call the function again to continue the loop.I can get the loop to work fine by calling the function but how do I STOP the function? Also I want to call it later on. Is there a way to start and stop a function?
function wobble()
{
var ws = .1;
var dis = 1;
[code]....
View 2 Replies
May 14, 2009
I'm try to calling my sloppy global function by calling my global function class as u can see below.[code]
View 2 Replies
Jan 16, 2009
i have a movie clip of a square in the library exported as Square1, i place 2 instances of it on stage and push them to an array called ar i add event listeners to both ar[0] and ar[1] to do a certain function. i need flash to tell me wheter ar[0] or ar[1] called the function.
View 6 Replies
Dec 11, 2003
the *who.say* in the following function refers to a var displayed inside a dynamic text box.
when I tryed to call the function twice, from the same MC, only with different Who's and What's, it didn't work. only one call displayed the text.
//*who is talking, what is he saying, and for how long his text is displayed**
function saythat(who, what, fortime) {
starttime = getTimer();
[Code].....
View 2 Replies
Mar 2, 2007
I'm writing a class that utilizes the whole screen resolution and need a movieClip to adjust itself in accordance to that. That "almost work". The problem is that I cannot call functions when the resize listener kicks (onResize = function()) in, and I don't understand why I want to call the function centreMe() from within the onResize function.
Code:
import mx.transitions.Tween;
import mx.transitions.easing.*;
import mx.utils.Delegate;
class centre {
public function centre() {
[Code] .....
View 3 Replies
Feb 9, 2010
In my application in the first frame I have the following: this is a simplified version,
Code:
import com.Menu.Menu;
import com.Papervision.Papervision;
[code]....
View 13 Replies
Aug 1, 2009
I'm using FLex Builder and in my Main class I load an external swf. In the external swf there is a movieclip on the stage called house. In the library I have that movieclips Class name set to a class I defined called com.buildings.House
When I load the swf from the main class I'm trying to access a function called setup in the class called House. I have tried a bunch of different ways but I get errors for them all.
Code:
private function onLoadSwf( url : String) : void
{
var loader : Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onImageLoadComplete);
loader.contentLoaderInfo.addEventListener(Event.INIT, onLoadInit);
[Code]....
I'm at a loss right now and its driving me mad. In flash I used to use the var externalSwf : MovieClip = evt.target.content; example and it worked but with Flex Builder its throwing error saying setup is not a function.
With the Imap interface its saying externalSwf is null.
View 6 Replies
Sep 26, 2010
I want to call a function on the "Driver" class which is the main document class, from another class.
but i always get this error. 1061: Call to a possibly undefined method Test through a reference with static type Class. here is the main document.
[Code]...
View 5 Replies
Mar 14, 2009
I have a program that is displaying a number of images from an XML file. The images are being resized and displayed through a loop function. I'm creating a new Loader each time through the loop and adding it to the stage. The problem is, I then want to create an event listener that will call a function for a mouse event for each image. The first issue I'm running into: how do I determine which image is which after loading them to the stage (say I want to display a large version of the image when the small image is clicked)? Secondly, since I'm creating the Loader within the first function, how do I pass the Loader to another function, say the one called by the mouse event listener? I'm sure I'm going about the fundamentals the wrong way.
View 3 Replies