ActionScript 3.0 :: Controlling Object From Child .as File?
Jan 24, 2010
If I import pgming from one AS into an overall one like this:
import asFiles.slideshow.*;
public var slideshowAS:Slideshow;
//then later:
[code]...
how do I control one object that is within that child .as file from the parent .as file?so for instance if in the slideshowAS there is an item called "nextBtn" and I want to be able to do something with it in the parent main menu .as file.
View 15 Replies
Similar Posts:
Jan 24, 2010
If I import pgming from one AS into an overall one like this:
[Code]...
how do I control one object that is within that child .as file from the parent .as file? so for instance if in the slideshowAS there is an item called "nextBtn" and I want to be able to do something with it in the parent main menu .as file. If you could even direct me on what to search under I that would be very helpful! I tried googling it but did not know how to search for it.
View 2 Replies
Jun 20, 2009
I have an FLA file with a movieclip on the stage which is labelled "blok", and a button on the stage labelled "button1". This FLA is attached to a file called main.as through the document class.
In the same folder where I am storing main.as I have a second .as file called secondFile.as. I have imported this class into main.as using: import com.tests.secondFile;
and in the constructor of main.as I have put:
loadB=new secondFile(button1);
addChild(loadB);
Within secondFile.as my constructor looks like this:
public function secondFile(button1:SimpleButton){
button1=button1;
button1.addEventListener(MouseEvent.MOUSE_DOWN, buttonPushed);
}
[Code]....
Basically I'm trying to get the MovieClip labelled "blok" to move by 50 pixels on the stage when button1 is pressed, but when I test my FLA I get the following error:
1119: Access of possibly undefined property blok through a reference with static type flash.displayisplayObjectContainer.
I would have thought that this.parent.blok would control my movieclip labelled blok on the stage of my FLA from within secondFile.as since secondFile.as is a child of main.as which is the document class of my FLA, but obviously this is not right.
how to access labelled items on the stage from within a child object.
View 6 Replies
Nov 17, 2009
I have been trying all day to find a solution to this, to no avail.. My project has a frame built in flash that loads an external swf via the addChild command. In that external swf, there is an FLV playback component that plays videos on the video tab. (There are home, video, web and contact tabs all in the parent swf) What I want, is for the FLV component to stop playing the video when one of the other tabs is clicked in the parent swf..
View 2 Replies
Oct 19, 2008
I have loaded a SWF and attached to a MovieClip which exist in my current movie using the following code, and now I just want to access the loaded SWF to send it orders like play() or gotoAndPlay(); I have tried also: container= MocieClip(loader.content); instead adding child, but it trhows an error
View 10 Replies
Dec 16, 2010
I have an Movie Clip in Flash that have subobject of button type which has subobject of input text and movie clips. Right after creation core Moveclip all subobject are set to null, when I expect them to be valid objects.
[Code]...
MC_Core_design was created in Flash and exported to Actionscript. I've done this for button_1 class aswell. The code was written using Flex. When I comment out both lines that result in error I get correct view of the core Movie clip with all subobject. How can I set subobject properties right after object creation?
View 2 Replies
May 14, 2009
i'm a designer trying to step up my flash skills and have a scripting problem that's causing me trouble. essentially i have a child swf loaded into a container in a parent swf and want the child to be able to instruct the parent. to explain in full, the child contains an flv with bespoke video player components. it's container sits in one frame of the parent. when the flv finishes playing, i need the parent swf to move onto another frame.
as it's a controllable flv, it isnt possible to predict the exact length of time the child will need to be present, so it literally needs to tell the parent it's finished playing at that very point.
[Code]...
View 9 Replies
Sep 26, 2010
This code is currently contained within my "mc_1" movieclip. I want to be able to have this code on my main timeline, however no matter what I try I constantly get errors, multiple different versions. I've tried adding mc_1 infront of everything, but that just gives an output error about a Sprite.Also, I'm currently using visible to control whether the back image to the textbox should show - What I'd really like to do is control it using a child, but they're movieclips not buttons, so when I try to addChild within the function it errors saying I'm trying to control a movieclip within a simplebutton function.
import flash.events.MouseEvent;
stop();
mc_textbox.visible = false;
[code].....
View 12 Replies
Dec 23, 2009
I have a sprite in which I have added other sprites. Something like:
var sp_main:Sprite = new Sprite();
var sp_group:Sprite = new Sprite();
for(i:int = 0; i < 10; i++)
[Code]....
View 1 Replies
Feb 14, 2012
I have a MovieClip named "all_Pages" inside of it has timeline tweening on its child "pg" which has sets of pages as child of pg on framesHere is the problemI am trying to execute the code written on all_pages first frame which is 6th frame
all_pages.pg.gotoAndPlay(6);
while executing all_pages.gotoAndPlay(1); // timeline tweening
i.e
[code].....
View 7 Replies
May 25, 2010
I want to listen for a custom event dispatched from the document class in a custom subclass. For example, let's say in the document class I have:
ActionScript Code:[code]....
So that the subclass will trace 'Event from document class received' when the 'customEvent' event from the document class is listened by the eventlistener. However, the output is only 'customEvent dispatched', meaning it wasn't heard in the subclass.
View 7 Replies
Mar 6, 2009
I'm pretty sure this is possible, but I can't get it to work. I have a main movie and in one frame I am loading in another swf. The user goes through the activity in the loaded swf and then needs to continue on in the main movie. I've added code in the last scene of the loaded swf that I thought would allow it to navigate to the next frame in the main movie:
PHP Code:
function next4(evt:MouseEvent):void {
this.parent.parent.gotoAndStop(4);
} continue2_btn.addEventListener(MouseEvent.CLICK, next4);
But when I play the main movie, I get the error:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at ELC_fla::MainTimeline/frame3()
I have tried to communicate to the continue button in the loaded swf from the main movie, but that didn't work either.
View 7 Replies
Jan 9, 2011
i have two movieclips on stage, one load as a class an mc with animation, the other load a button...how can i send the message, comunicate both clases to let the button start the animation?
View 4 Replies
Feb 1, 2012
I'm rendering a xps file using flash (no MX or Spark), and I'm running into a sort of 'contradiction' that I'm unable to solve. [Note, that I'm trying to work only in core flash (e.g. Sprite, Shape, etc.), I've already solved (sort of) this issue using Spark.]
The pages of the xps file specify an explicit size. However, the content described (especially paths) in the xps file can sometimes extend outside of this area.
The problem is, I want the parent Sprite to have the size specified by the xps file, for example so scroll bars match the page size (not the sprite size), but in some cases the Sprite is much larger than this.
I've tried recursively going down and scaling everything UP, and then at the end scaling the parent container DOWN. Unfortunately, this causes translation problems with paths, and I assume it can also cause problems with bitmaps, etc.
Without using MX or Spark, is there anything I can do to control the size of the parent Sprite, other than scaling all the children independently?
View 1 Replies
Sep 14, 2011
I recently bought an mp3-player coded in Flash and it works great, except for the fact that I do not want it to appear constantly on the timeline.
The mp3-player is generated throught code, so I was wondering if there is a way to control the alpha of a variable named mp3playerContainer and set it to 0? I have navigation points on frame 25 and 55 where I want this mp3player to not be visible. Could it be an idea to use "currentFrame", so that if currentFrame equals 25 or 55, then alpha of the variable mp3playercontainer will be set to 0?
View 2 Replies
Mar 3, 2010
Can one.swf file control the actions of another .swf file contained in the same HTML page?ample:FloatingMenu.swf would control the timeline in MainStage.swf
View 1 Replies
May 10, 2002
I have one window for my navigation(N). The links open in another window(A)How can I tell window (A) to start playing the .swf on frame 2, from window (N)?
View 5 Replies
Jan 23, 2005
I load a movieclip via:
on(release){
loadMovieNum("detection.swf", 1);
}
So I load it in my current timeline on level 1. Now in the detection.swf is a button that has to controll the first movie. (that loaded the swf)
[Code]...
View 1 Replies
Jan 9, 2007
How to control the scalability of certain objects in a flash file. I'm trying to create a full page flash site where the scale of the certain objects stays the same, but a background image scales to how large a user's screen is. A great example of this is at "[URL]."
View 7 Replies
Jan 8, 2010
Another question regarding externally loaded .swf's!
In my externally loaded swf.s are a pause and play button which work perfectly using only:
on(release){yanm.play();}
(yanm being the name of my movie file containing my movie!!) and obviosuly the stop is with a stop!
Now I want to add a 'Mute' button so that the user can turn off the audio. What script would I use for this?
I also want to use a 'Rewind' or 'Restart' button to return to the beginning of my movie and begin playback again. What script would be used instead of .play?
View 3 Replies
Jul 21, 2010
I have a loaded swf file that is a short animated intro I am using he addChild method. I wold like it to simply move the timeline to a label "menu" after it has played. This is the cde on my main Timeline:
stop();import flash.display.*;import flash.events.Event;import flash.media.SoundMixer;
var Xpos:Number=0;
[Code]....
View 7 Replies
Jan 23, 2005
I load a movieclip via:
on(release){
loadMovieNum("detection.swf", 1);
}
So I load it in my current timeline on level 1. Now in the detection.swf is a button that has to control the first movie. (that loaded the swf)
I tried:
on(release){
_level0_root.nextScene();
}
Which did not work. Referencing via _root.nextScene() also, because the loaded swf has its own _root. So how can I control the first movie out of the loaded one?
View 1 Replies
Aug 4, 2010
I've got a project that has an FLV with cue points controlling when graphics appear in the swf file. The graphics are being loaded into empty movie clips via AS on the stage (everything is being loaded and unloaded into the first frame of the main stage). What the client wants is a pause button that will pause/play both the FLV and graphics being loaded in the swf.
View 1 Replies
Mar 11, 2010
I have a movie where on the main timeline stage I have placed a movie clip (Clip1) and a dynamic text field. I have a .txt document that contains a variable that will always be a number (Var1).
Currently, the dynamic text field reads Var1 and displays that number. This is great, but I want Var1 to be used in 2 places:
How can I get Clip1 to also read Var1 and, based on the number that is Var1, play a certain frame of Clip1?
I'd like it to go like this: If Var1 is <1000 then play frame1, If Var1 is =1000 and <2000 then play frame2, If Var1 is =2000 and <3000 then play frame3, and so on...
View 17 Replies
Dec 4, 2010
I am trying to create a global function to reuse repetitively. It worked until I moved the function to the external .as file. The problem is with MovieClip(root) and MovieClip(parent). They do not work and cause errors.
[Code]...
View 0 Replies
Oct 23, 2006
how to control the visibility of certain buttons from an external file (like scroll bars). I have been able to do this with button function using a loaded variable and if statements on button release, but I have been unable to replicate this with visibility. I really need the button to be visible or not from the initial load of the .swf file. Any suggestions? I currently have to open flash and change the action script within the flash file and export a new .swf, and I want to be able to do it by changing a .txt file.
View 1 Replies
Mar 25, 2009
I have a picture on the stage that has multiple items that have hotspots/links over them that should open a child swf on top of the background and show details about the items. then have a button in the child swf itself that removes the child from over the background so the user can click on another item etc.I found this code in someone's post and I am trying to modify it so that works for multiple swf files...it currently works for a single swf.I wan to pass the name of the button in front of the .swf in the URLRequest to have the same name as the instance name of the referring button. But I can't figure it out. Here is the code I am using on the stage
View 2 Replies
Oct 25, 2010
I'm trying to control the behavior of components in my Flash Library using a .as file class, but it doesn't seem to be working.
For example, if I have a Button in my library called exampleBtn and attempt to do this in the .as file:
exampleBtn.visible = false;
... nothing happens. The button is still visible in my application when I run it.
Can anyone explain the workflow to make a Flash library component accessible in a .as class file using Flash CS5?
View 1 Replies
Aug 1, 2005
I have an externally loaded .txt file, which has its font style set by the dynamic text object I created. But I was wondering if its possible to control the font style from within the .txt file? I've tried setting the dynamic text object to render as HTML and added some HTML code in the .txt file, but that doesn't work.
View 2 Replies
Mar 16, 2011
I've got the following file reference listener on a file to upload art for display on a flash movie. However, I want this to display only at a certain size. I tried the "easy way", but this ends up sizing down my whole movie. Where should I insert the code to get the uploaded file to show on my flash movie only to a certain height and width? "chip_clip" is the empty movie clip this is being uploaded to:
var file:FileReference = new FileReference();
file.addEventListener(Event.SELECT, fileSelect);
file.addEventListener(Event.COMPLETE, fileComplete);
[Code].....
View 2 Replies