ActionScript 3.0 :: Controlling MC's On Stage From Within Other MC's
Feb 22, 2011
I am trying to control a movieclip's visibility on the main stage from within another movieclip. I have read many forums and tried pretty much everything without any success.
Here is an example: I have two movieclips on the mainstage. one called: animate_mc another called: info_mc
Inside animate_mc, I have a button & a function that when pressed should hide the info_mc. I have tried: this.parent.info_mc.visible = false; stage.info_mc.visible = false; (_)root.info_mc.visible = false; To name a few of many other possibilities I have tried, but I still have not managed to make it work.
I have a main ButtonClassTest class that extends the MovieClip class. Then I have a ButtonTest9 class that extends this ButtonClassTest and a ButtonTest9.fla.It works fine (click, rollover, etc) when I link a movieclip in the library of my ButtonTest9.fla to ButtonTest9 and place instances of this mc on stage (button1_mc and button2_mc). However, I'm not being able to control anything about the instances themselves, like, setting button1_mc.alpha = .5 in my ButtonTest9 class.I tried a whole bunch of things, like Stage., this., putting it into functions, not linking the mc in the library and using new ButtonTest9 instead.
Let's say that I've a button object (instance of Flip) and a coin object (instance of Coin) on the stage. The coin object has two frames: one showing Heads and one for Tails.
MyCoin class is as following:
package { import flash.display.MovieClip; public class Coin extends MovieClip
[Code]....
Problem: How do I reach the coin object on the screen via onMouseClick function? Let's say that the object on the stage has instance name of myCoin. I suppose that had I not done this with an external class and simply used actions from the frame I could just use the instance name as a variable. I couldn't figure to do the same it in an external class. Do I first create the object which is already on the stage?
I'm trying to say, "if the stage width is over 1300, then make the stage 1300. If it's less than 1300, just let it be whatever value it already is. I tried this but it doesn't work.
I have a function that expands the stage width to be whatever size the browser window is, but don't want anyone with an apple cinema display or something comparable to have the stage that wide.
I'm trying to say, "if the stage width is over 1300, then make the stage 1300. If it's less than 1300, just let it be whatever value it already is. I tried this but it doesn't work.[code]I have a function that expands the stage width to be whatever size the browser window is, but don't want anyone with an apple cinema display or something comparable to have the stage that wide.
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.
What I am aiming for is to have a way to pass "kabinet", or "operativni" etc. to a function or smth... The code is used to control mc buttons on the stage. It works, but it's ugly and not practical, obviously. I tried with [var]onRollOver = function() { Inside a function, var being the parameter of said function ("kabinet", "operativni" etc.), but to no avail. Also tried with the with(var), thingy, but with the same result.
ActionScript Code: myTextField_txt.defaultTextFormat = new TextFormat("monotype", 16, 0x0CFF00, true); This controls the output to the stage of my fetched text. It works great, but I would VERY much like to control this externally as well. The color for example. How would I call this in a flash variable to change the color externally? Is it possible with this code?
I created a 300x250 Web banner for Google with a mouse trail effect. The banner will not upload because, according to the Google tech people, the banner contains animation that goes "out of bounds." Common sense tells me that if a mouse effect is applied to a Flash banner, then it should only be occurring when a user mouses over that banner. However, I was told that the mouse effect does indeed take place outside the 300x250 banner boundaries, which is preventing the banner from being fully uploaded live.
Does anyone know how to define the stage area so that the mouse effect only occurs in this 300x250 space? Perhaps the only way to get around this is to create a 300x250 hidden button and somehow make the mouse effect occur on rollover. If that is the case, then does anyone know how to do that?
i have two MC with two swf files loading into them on my main file. what i am trying to do is have buttons in one MC move something in the my 2nd mc. i know that the _root. will work for controlling my main file but I'm don't know how to go about controlling anything inside of other movie clips.
I have a site I am working on which has a Flash intro. The other pages of the site hold a menu that's created in Flash. For some reason my client wants the ability to go back and view the intro again, which is easily accomplished with navigateToURL. HOWEVER the intro is broken into two distinct parts and I need to target the second part, which would require something along the lines of gotoAndPlay(500); or something to that effect.
What I am having problems with is how do I target a specific frame in a completely different movie, the intro, using a button from the Flash menu within the site. I'll try to explain it a bit easier. The top button on staticMenu.swf, which is placed throughout the site (aboutus.aspx, portfolio.aspx, etc...) needs to target frame 500 of mainIntro.swf which is embedded in default.aspx.
I'm mostly a point-and-click user of flash. I'm in CS5 and have built a simple flash website (with A/S1-2) having a primary swf (content.swf) and other transparent swf (home.swf, contact.swf, etc.) that load in for each menu button. When another menu button is clicked, my A/S instructs to unload all mc's from level 1 and load in the next swf in that same level.My challenge. I need to have a button in "home.swf" go to, say, "contact.swf". How can this be done?
I have to control one swf file with anoter. The situation is as it follows: there are two swf files in my HTML page. One of them contains a movie clip, and the other - buttons, which must control the first one - for example play this movie clip, go to a frame in this movie clip and so on. Is this possible? Maybe there is a way to connect both swf files with AS and after that use the inner instance names.
I have 2 swf's on one HTML page in 2 sperate cells of a table. Each one is a file-o-fax style tab menu. I want to be able to make the tabs in the unselected swf retract to their original position, when using the other swf.
Is there a tut kirupa or other on controlling one swf from another.so clsic example having a loaded playback bar then loading vid or mucis and the universal playback bar can control it.Could this be done either way of loading swfs (Into a movie on the main swf or loaded by levels?)
I've got two Movie Clips "MC1" & "MC2" on my main timeline with buttons that give them life so if i click on "MC1" then it plays the open and stops on the "up" frame the next frame in the movie is the "out" which plays the Movie Clip out. but when "MC1" is up and you click on "MC2" i want "MC1" to play the out frame. I'm guessing at this but is this anywhere close?his is the code attached to the button inside of "MC2"
I have a external .flv movie, that loads as a full screen background movie on the main stage. Using the Netstream class and the instance name of 'netStream' I just want to be able to pause/play this movie when the user click on a button. The button is inside a movieclip.
I thought something like this:
on (press) { netStream.pause("http://www.website.com/background.flv"); }
I'm attempting to create a website that uses externally loaded swf files into a shell animation like in Creating A Full Flash Site, only I'm trying to give each swf its own website url (ie. site.com/home, site.com/page2) while still using a single shell animation.
I have three buttons I have built as MC's. In each on the MC's timeline I have another MC's with instance name voted01_mc, votecd02_mc, and voted03_mc, respectively. And each of the MC Buttons have instance names Q01_btn, Q02_btn and Q03_btn.
I would like to find a way to control the "visibility" of a movie clip inside one movie clip from inside another MC. I am sure there is a way to do this such as:
i am trying to control 30 instances of a movie clip dynamically. the instances are as follows
ship1 ship2 ship3
[code]....
coming from php i would just set up an associative array like list array('speed'=>array(false,false,true,...),'weapon '=>array(true,false,....and so on I can not for the life of me figure out how to store this information and then use it as a variable name later.my end result should look something like this .. i just don't understand how to do this in as3 .. it seems unnecessarily convoluted.
Code:
foreach($upgrades['speed'] as $key => $val) { UpgradeScreen.'speed'.$key.visible = $val); this would dynamically call
[code]....
i know the above is incorrect.I want to create this so that it is completely dynamic and the instance names can be feed in dynamically as the array or whatever is being looped.
I dont really know if I can put this into words correcly so I'm including enough code(AS3) to show what I mean. I can see the results from my trace statement so I know my function is ok, but I'm seeing an error once I try to make my MC disappear. Need something inplace of "this.lowerThird_mc.visible = false;". Also, I should note that this code is in a MC that is on the stage where the other MC is.
function onCuePoint(infoObject:Object):void { if (infoObject.name == 'CuePoint5') {
I was wondering if I could assign seperate buttons to play, rewind, stop or pause an FLV in my timeline from a seperate area of the page like a remote control as opposed to using a skin in which the buttons would have to sit under the flv. Do I have to use an events listener? Does anybody have an example of the action script I could use. I am using version 2.0 PS. The flv is a progressive download.
I have a small website and on one of the pages I have a progressive video inside an flv component. However, when I go to a new page the video plays in the background and if I hit the play button twice, the video 'double plays'. Is there a way to control and flv component with actionscript 3? I tried using the stop(); command within the function that selects the pages but I get an error message:
Well, I have a project where I would need a XML with a % range from 0-100 to controll a timeline. The concept is to fill a bottle. So the timeline would animate from empty to full. But must be controlled with a XML number and its all in AS2...
I have a SWF embedded in an HTML web page and want to move to a specific frame when a trigger is clicked. But nothing happens when I click the trigger, as though the js just doesnt communicate at all with the swf.SWF is written in flash cs4 (a3)The link to the website is [URL]..I have read the text books over and over and researched high and wide on the internet and as far as I see I have done everything correctly but I cannot get this to work. The swf is very basic, just a green box moving accross a small stage. The desired gotoframe would make it cross at a lower height (just a dry run for a more complicated swf)
I am embedding a swf built in flash 8 into an as3 project. When I call stop() or gotoAndStop(0); on the MovieClip that represents an instance of the embedded swf it stops for a sec and then continues. Trying to call removeChild on the mc removes it from the display but the audio in the swf keeps playing. The swf, in this case must be embedded, I cannot use loader.[code]
I am working on a project that needs to have the swf controlled by an external javascript file, I'm looking for something very simple like basically telling the swf what frame to go to in the main timeline. I know it's possible because I did it 4 years ago, the problem is that project and computer are long gone.
I've loaded my external SWF, now I want to animate a MC within that external swf, however, when i try, the animation freezes (or won't start at all), but the external SWF DOES load.Here is my loader code
Code: var _externalMovie:MovieClip var _url1:URLRequest = new URLRequest("intro.swf")