Flash :: Accessing A MovieClip On Script?
Aug 20, 2011
I'm used to working with AS3, but due to recent events I need to work with AS2, and I'm having trouble with a simple task: How do I access a MovieClip in AS? I drew something, converted it to a symbol (of type MovieClip) and ticked "Export for ActionScript". I gave it the name "MyMC". now, when I'm in some other MovieClips action, how do I access the MovieClip I drew on stage before?
View 1 Replies
Similar Posts:
Nov 1, 2011
I am trying to access movieclips within my movieclip using a for statement. To try and make this clear, here is how it looks at the moment:
sections = Holder movieclip where dtf_sections is placed, as well as other clips that are needed.
dtf_sections = Where all the title movieclips are placed that are going to be used when called. Placed in here to make it easier to move, within sections
title = Movieclip that contains the text that needs to be changed, within dtf_sections
Here is my code that works:
sections.dtf_sections.title1.dtf_title.text = "Section 1"
There are upto 10 titles within dtf_sections. So, what I thought would work is this:
for(var i:uint=1; i<10; i++){
sections.dtf_sections.["title"+String(i)].dtf_title.text = "Section" +(i)
}
The reason why they are within the movieclips is masking, and appearing at different times.
View 1 Replies
Oct 19, 2006
Using MovieClipLoader, is it possible for the loaded swfs to access movie clips in the container swf movie? In building a preloader for a previously produced flash app (originally made for CD), I was running across huge problems with some dynamically created masks (created using attachMovie and setMask). My solution (not ideal, I guess) was to move the masks and the masked objects into the preloader ("container") movie. But still need to move them around by code located inside the swf being loaded.
Relevant code from inside the preloader:
myMCL.onLoadInit = function() {
_root.attachMovie("screenText12", "screenText12", 15)
_root.attachMovie("internalMask", "internalMask12", 17)
_root.screenText12.setMask("internalMask12");
}
And from inside the swf being loaded:
_root.screen12.onMotionFinished = function() {
screenText12InY = new Tween(_root.screenText12, "_y",mx.transitions.easing.Regular.easeOut, 463, 403, .5, true);
The red is where I'm not sure of how to get in contact with the movie clip in the preloader.
View 1 Replies
May 21, 2010
Document Class 'whatwedo'
[code]....I'm trying to access the loadMC movieclip in the document class. It dosnt work,
View 6 Replies
Jan 10, 2011
What is the best way to accessing movieClip from a flash stage in AS3 Class? And what if the as3 class it's in a package, outside the Document Class?
View 4 Replies
Apr 7, 2011
I want to dynamically load the graphic of the button into an mc inside each frame of the button (up and over). Inside each frame I have a movie clip (canvas and canvas_over). The green box is the button object (header_btn):
This is my code:
var hLoader:Loader = new Loader();
hLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, hLoaded);
hLoader.load(new URLRequest("[URL]"));
function hLoaded(event:Event):void {
[Code] .....
It would be nice though if as3 allowed for buttons to contain objects.
View 1 Replies
Jun 23, 2010
import com.hydrotik.queueloader.*;
.................
public class Main extends MovieClip
{
[code].....
I need to get access to loaded STRATTransitions.swf from the main movie and remove some text from it. There is no source code available for the swf.
View 1 Replies
Jan 11, 2011
test.fla's document class is Test.as
test.fla's library has two MovieClips ThingMovieClip and Thing2MovieClip
I tried accessing the Thing.as public var thingState's property;
directly,
using something called Casting (??),
assigning an instance name,
but something that seemed so simple doesn't work,I commented the errors I got next to each way I tried,conversely how would I access the MovieClip Thing2MovieClip from Thing.as (which is a child of Test.as because that's where it's instantiated), it just doesn't recognise an object of its parent exists, here are the 2 classes:
package com.hello.test.test
{
import flash.display.Sprite;
import flash.events.Event;[code]........
I think i'm missing some basic but fundemental understanding of ActionScript 3 and I have no other knowledge of other scripting /programming languages either.when I follow tutorials exactly they seem simple enough, but then start applying what I think is logical usage then it throws up errors..
View 2 Replies
Feb 16, 2011
I have a MovieClip, that I'm going to add to the display list with my document class at runtime beacuase there will be many instances of it. The MoviClip "box" has 3 more MovieClip instances inside it,and each of those three have two more.It looks like this:
box
circle 0
oval0
oval1
[code]....
View 2 Replies
Aug 28, 2010
i've been all afternoon trying to figure out a solution to my problem, and I can't seem to find it, or cannot implement it. Let me lay it out for you: I have an actionscript file linked to a movieclip. (movieclip:skate class linked: generic_skate).I have it set up that way so I can create an array of skates easily (i'm using a for loop to create them), and each skate has its own attributes (name, description, price and the image that is supposed to go on the deck)In the stage, i have three text boxes, one for the price, other for the name, and another one for the description.In the generic_skate class, I'm handling all the mouse events (in this case mouseOver and mouseOut.
What i want to accomplish is: when the user hovers over a skate, the info shows up in the text fields and when he hovers out, the info goes away. My problem: Since I'm doing all the mouse interaction in the class file, my guess is that I have to access the stage to get to the text boxes that are placed there to change its info or somehow create a "middle" man to do all the handling.
View 5 Replies
Feb 1, 2012
I have got two movieclips on the main timeline. First one is envelope_mc and second is bg_main. In envelope_mc timeline there is a button on 25th frame which plays ahead when clicked. Here's the code for first movieclip:
Code
on_btn.addEventListener(MouseEvent.CLICK, playAhead); function playAhead(event:MouseEvent):void { play(); }I have also got some animation on bg_main which
[code].....
View 3 Replies
Feb 1, 2012
I have got two movieclips on the main timeline. First one is envelope_mc and second is bg_main. In envelope_mc timeline there is a button on 25th frame which plays ahead when clicked. Here's the code for first movieclip:
Code:
on_btn.addEventListener(MouseEvent.CLICK, playAhead);
function playAhead(event:MouseEvent):void
{
play();
}
I have also got some animation on bg_main which I wan't to trigger on 30th frame (inside bg_main timeline) when button is clicked in envelope_mc timeline. Here's the code for second movieclip:
Code:
MovieClip(root).on_btn.addEventListener(MouseEvent.CLICK, playAhead);
function playAhead(event:MouseEvent):void
{
play();
}
Complete error:
TypeError: Error #1010: A term is undefined and has no properties.
at Flashphotographygallerywebsite7_fla::bg_1/frame25()
View 1 Replies
Dec 8, 2010
I am trying to access the variable myParentVariable within the function myParentFunction() from the MovieClip's myMovieClip_mc function myMovieClipFunction().
I know that It works if I declare the variable myParentVariable outside of the myParentFunction() but I don't really want to do that
main timeline
//-------------------------------------------------------------------- ---
myParentFunction();
function myParentFunction():void
[Code]....
View 1 Replies
May 17, 2011
I'm trying to access a parent movieClip from the child movieClip
Here's what I want to do,
I've got a movieClip named wrong_mc, which plays for a couple of frames and on the last frame, its got a close button "close_btn" inside of it, now I wanna write the code such that when close_btn is played the movieClip "wrong_mc" should go and stop at frame1, I'm just not able to access this movieClip from the button.
View 5 Replies
Dec 13, 2009
I have created a new instance of a movieclip and named it in as3.
I want to put this in another movieclip. How does this effect the reference because everything seems fine while the dynamic movieclip is just dealing with the stage. As soon as I put it in a movieclip, I get:
Error #1009: Cannot access a property or method of a null object reference. at com::Gallery/instancesOut()
Heres part of my code:
for(var i:int = 0; i < 20; i++){ var transition:mcTransition = new mcTransition();
addChild(transition); transition.name = "transition_mc" + i; transition.x = i * 100;
I can reference using the string name but if I put the addchild in a movieclip it errors
Transition_mc.addChild(varTransition);
View 1 Replies
Feb 24, 2011
I am trying to get to a
movieclip nested inside a movieclip in As2:
MovieClip1.movieClip2.movieClip3.gotoAndStop(2)
MovieClip1, MovieClip2, MovieClip3 is instances Names.
View 2 Replies
Apr 27, 2011
I made a script that creates a MovieClip (two stationary Ovals, side by side) from the library and transports them from the left side of the stage to the right.The idea would be to make the RIGHT Oval decrease in size as the MovieClip is traveling while keeping the LEFT Oval the same size. (All of them being part of an Array)I thought to convert the right Oval to a MovieClip within the parent MovieClip, but I have not been able to access the ".width" and ".height" of the nested MovieClip.Not sure whether I'm on the right track or not.
View 5 Replies
Oct 28, 2009
I'm trying to build a website but i'm experiencing some troublesI now have 1 movieclip "menu" on my stage wich contains my navigation bar (home, contact, gallery,...) and on the same stage i have a movieclip "middle" wich contains 3 frames 1 for home, contact etc... What i wan't to do now is write my code in the "menu" movieclip and access the 3 frames in my "middle" movieclip, so what i wrote in "menu" was this:
home_mc.buttonMode = true;contact_mc.buttonMode = true;gallery_mc.buttonMode = true;menu_mc.buttonMode = true;
home_mc.addEventListener(MouseEvent.CLICK, homeClick);
[code].....
View 7 Replies
Mar 2, 2011
I have a helicopter that i have drawn in the flash ide as a movieclip inside my library and a turret as a seperate movieclip that has been dragged from the library onto my helicopter movieclip.Is there anyway to programattically access that turret movieclip for a seperate instance of the helicopter?
e.g.
Code:
var helicopter1 = new Helicopter();
var helicopter2 = new Helicopter();
addChild(helicopter1);
[code]....
View 3 Replies
Mar 13, 2009
DocumentClass is a class that is also my document class for my fla (hence the name) and I have a movieclip on the stage with the instance name "player" which means that the player "belongs" to DocumentClass.
Without extending DocumentClass to CollisonDetection, how would I be able to access player from the CollisonDeteciton class?
View 5 Replies
Aug 29, 2011
The issue I am having is that I have no idea how to access the Children of another MovieClip. I have 2 MovieClip's, storeFront, at frame 25, and reviewPage, at frame 60. storeFront contains a vector, cart, and I need to access it from reviewPage.
I have tried...
var appRoot:MovieClip = parent as MovieClip;
buff = appRoot.getChildAt(30);
review = buff.cart;
[Code].....
View 5 Replies
Aug 28, 2009
trying to export a very large image from flash for days now and my latest approach has lead me to AS3. (I usually use AS2). AS2 was causing endless problems with the PHP server timing out (the raw pixel data was over 8MB) but I have the save function working thanks to this great class. The problem is, this function only works on local movieclips.
I have imported my whole AS2 project swf into an AS3 swf at runtime and now I need to find a way to send one of the AS2 movie clips as a parameter to Mark Knol's "save to jpeg" function from the class above. I've tried gSkinner's SWFbridge class but the flash LocalConnection method only seems to allow calls to a remote function, rather than call a local function on a remote movieclip.
View 2 Replies
Mar 6, 2009
I have a button, inside an mc1 which when clicked it plays
[TweenLite.to(mc2, 2, {frame:1});]
inside mc2 -which located back on the stage.
Currently I get the error of "access of undefined property)".
View 3 Replies
Aug 24, 2010
My problem is that I created my buttons on the stage and then grouped them together as a movieclip called navSat.Then I set the Linkage for navSat to NavSat.I am doing all my coding through AS3 outside of this. This is my code:
Importing the NavSat MovieClip
Quote:
function loadNavSat():void {
var newNavSat:MovieClip = new NavSat();
addChild(newNavSat);
[code]....
When I run the swf now, my navigation system comes in and all the buttons are working (up, down, over, off states are working) It still links to nothing yet. The problem is when I try to add functionality to those buttons. I have tried about 5 days worth of variations around this type of code but cannot 'communicate' with the buttons within the movieclip. This is my code for the 1st button - contactBtn (linkage: ContactBtn):
Quote:
contactBtn.addEventListener(MouseEvent.MOUSE_DOWN, contactDown);
function contactDown(event:MouseEvent):void
{
[code]....
View 1 Replies
Feb 20, 2011
I have created a movieclip (game_container_mc) in the main.as file and I want to add a child (enemy) to it from a different file (makeWave.as) how would I do this?
View 7 Replies
Dec 18, 2008
I have a movieclip placed on the stage called splashScreen. Inside this movieclip i have a button called easy_btn on the second frame but every time i try and access this button from the main timeline using actionscript i get the message TypeError: Error #1009: Cannot access a property or method of a null object reference.
I'm not sure why because i think i have referenced it properly. Here's my code -
splashScreen.easy_btn.addEventListener(MouseEvent.CLICK,
chooseEasy);
function chooseEasy(evt:MouseEvent):void{
[Code]....
View 2 Replies
Apr 25, 2010
I want to add a child to a movieclip on the stage and then modify its opacity, but I got a problem, when I try this:
ActionScript Code:
var a = new LibraryItem();
mconstage.addChild(a);
mconstage.a.alpha = 0.5;
I get an error saying that mconstage.a is undefined... and in fact if I trace it I get "undefined".
View 4 Replies
Sep 1, 2010
This is probably a very simple solution, but I can't seem to find it online. Basically, I have a button that need to change a movieclip's frame in it's parent.So I tried:
ActionScript Code:
_parent.slideshowImages.gotoAndStop(2);
But it's not working! I know I'm getting to the right locaiton because _parent holds a variable, and I can access that just fine. But I for some reason can't access the movieclip at all.
Note: I can't upgrade to AS3 (What I'm used to) as this isn't my file.
View 9 Replies
Dec 15, 2011
I am have created a simple fluid website, containing a menu, middle, and footer fluid movieclips that follow as the user stretches the egdes.
I have a button within my menu movieclip ("Menu" and "bio_btn" are the instance names)
In my "Middle" movieclip is where I will lay out frames of pages.
I want it so when the user clicks on the button "bio_btn" within the "Menu" movieclip, it will jump to frame 2 ("bio") under the "Middle" movieclip.
Now I have no coding in my fla file, I have coding in my external as3 file called Website, my fla file is Website. Here is the coding.. (in hightlight)
Code:
package {
import flash.display.*;
import FluidLayout.*;
import flash.events.*;
[Code]....
View 2 Replies
May 20, 2003
i made this code to dynamically create a menubackground of square tiles. I had no problem here...but then when i try to access them i dont seem to succeed...dont know how too.heres the first code creating the tilepattern...
amount = 0;
row = 0;
horiz = 0;
[code]....
View 1 Replies