ActionScript 3.0 :: Loading Movieclips With The Same Variable?

Apr 11, 2010

I have this function that loads swfs dynamically using the same variable

var Xpos:Number = 420;
var Ypos: Number = 155;
var loader:Loader = new Loader();

[Code].....

I want to use the same idea for movieclips that I have in my library They are already imported for as.30, but I can't figure how to dynamically place them and take them out of the stage using the same variable.

View 4 Replies


Similar Posts:


ActionScript 3.0 :: Controlling Variable Movieclips (within Variable Movieclips?

Nov 3, 2009

on my main timeline there is a movieclip ("sampleMc") which contains a number of labeled frames containing movieclips of gallery images (for example "dyerBikiniMc"). in turn, each of THESE movieclips contain a number of frames of detail shots of the main image (for example "dyerBikini00Mc, dyerBikini01Mc, dyerBikini02Mc, etc.").on the main timeline i have a gallery navigation bar with thumbnail buttons determining which image will be displayed. there's also a right arrow shaped button "detailsBtn" that i'd like to allow the user to click frame-by-frame through the detail shots of the image. i also have a before/after toggle button on the main timeline that needs to control the movieclip one level below that, where the before/after images of that particular detail shot are stored!

View 9 Replies

ActionScript 2.0 :: FMX:Loading External Variable From Text Into Variable

Sep 8, 2003

I want to load an external variable called name from a text file into a local variable in flash called my_str...here's what I have:

var loadText = new loadVars();
loadText.onLoad = function(success) {
if (success) {

[Code]....

I need to have the variable my_str available outside the function..

View 3 Replies

ActionScript 2.0 :: Targeting Different Movieclips With A Variable?

Apr 7, 2010

On my stage, I have a bunch of movieclips with sequential instance names ("toggle1", "toggle2", etc.). I also have another bunch of movieclips, each with their own sequential instance name ("name1", "name2", etc.).How can I set it so that when I click on a "toggle" movieclip, a specified property changes on the "name" movieclip with the same number.Here's what I have so far.

ActionScript Code:
for (var i = 1; i <= 16; i++) {[code]....

What am I missing/doing wrong?

View 1 Replies

ActionScript 2.0 :: IF And Variable Passing Across Movieclips?

Jun 13, 2003

I have six movie clips, in a navigation movie clip, on the main time line, here they are:

_root.nav._home
_root.nav._ourFirm
_root.nav._onepartnership

[code].....

View 1 Replies

ActionScript 2.0 :: Storing A Movieclips Instance Name In A Variable?

Feb 21, 2010

I have a movie clip and inside that movie clip there is a button. I will be copying this movie clip 40+ times. When you click the button it must seek out the reference name of the movie clip it is nested in. The point of the script on the button is to make all other boxes but its self vanish. The script needs to know what box it is so it can make all boxes but it's self vanish. I know that _name returns the name of the object the code is on but what about the movie clip the object is in maybe _parent._name?

View 5 Replies

ActionScript 2.0 :: Dynamic Variable Inside Movieclips

Jan 21, 2011

I recently started learning Flash and Actionscript and now I'm trying to write an actionscript for the first time. Im doing this in Actionscript 2.0.I have a movieclip that consists of two images and one dynamic text field with a variable. The name of the images are "VS1_P1_RUN" and "VS1_P1_OFF" and the name of the dynamic text field is "pumptext". In the dynamic text field I have the variable "VS1_P1_Ind". VS1_P1_Ind is probably a boolean variable as it shows 1 or 0 in another program but in Flash it shows True or False (not sure if Flash thinks it's a text/word or a boolean).My script is supposed to display the image named VS1_P1_RUN if the variable of the dynamic text field pumptext shows the text True and it goes like this:[code]

So I'm completely stuck in what to do. The bottom code works as it should but I want the images to show depending on the value of the variable VS1_P1_Ind. I thought just changing the text field to dynamic and typing the variable name in the variable field would do it but no.If it could be a clue to the solution I'll also share that the value of the variable is not seen/shown in textfield while inside the movieclip. Creating a dynamic textfield outside of the movieclip shows the value of the variable just fine, True/False.

View 1 Replies

ActionScript 2.0 :: Reusing Variable Names For Different MovieClips?

Jun 28, 2011

I'm creating a pacman game and basically I'm having trouble coding the enemies (ghosts), the code works perfectly with just one ghost, as soon as I add another it starts to go wrong.Firstly I've got this function which places the enemies:

Code:
//places the enemies
function placeEnemies() {

[code].....

View 2 Replies

ActionScript 2.0 :: Make A Variable Equal Two Movieclips?

Sep 2, 2004

Can I make a variable equal two movieclips? Like:

nav1 = _root.nav.nav1 & _root.map.map1;

And then run a function that would control both? Like:

function closeout() {
nav1.gotoAndStop(3);
}

View 6 Replies

ActionScript 3.0 :: MovieClips - Dynamic Naming Links To Variable

Jul 26, 2009

I am doing the following
Code:
Select allvar a:MovieClip = new MovieClip();
addChild(a);
Now what I want to do is I want to create six more mc i.e., a2,a3,a4,a5,a6. I want to accomplish this using loop like this:
Code: Select allvar i:Number = 0;
while(i < 6){
var a:MovieClip = new MovieClip();
addChild(a);
}

So with above method how can I give different names link above to var a? Then I am using all of these var as following:
Code:
Select allvar cube:Cube = new Cube(new MaterialsList({
front:a , left:a2, right:a3, top:a4, bottom:a5, back:a6}),200, 200, 200,10, 10, 10);
scene.addChild(cube);
How can I use those dynamic name here?

View 1 Replies

ActionScript 3.0 :: Variable Of Nested MovieClips Global Coordinates

Apr 24, 2009

I have a MovieClip ("mc3" that moves dynamically) inside of a MovieClip ("mc2" that moves dynamically) that is on the stage ("stage" that is static). I need to find the value of mc3's x in relation to the stage? I need to make it into a variable. I am trying to do the math, can't figure it out. Also tried localToGlobal and failed.

View 5 Replies

IDE :: Making A Global String Variable Visible To MovieClips?

Jun 4, 2009

I mostly use flash for the animation, so my action script tends to be mostly functional.

I am now however having an issue, i am using a variable called language which I am setting in frame one as "dutch", "english" , "german" etc... Im then using this to set dynamic text as appropriate in each frame as necessary.(and yes i may switch this to case statements )

if (language == "dutch")
{ tcMC.peasantBubble1.peasantSpeech.text= "Bescherm je een schat?"};

My problem is however that one Movieclip does not see the language variable.

Is there anway in CS4 i can direct it to where it is, or define the varibale instead to be global (perhaps id have to change it from a string though)?

View 2 Replies

ActionScript 3.0 :: Use A Variable(text) To Reference A Movieclips Instance Name?

Nov 28, 2010

i want to use a variable(text) to refrence a movieclips instance name

Code:
function InventoryShow(event:Event):void
{
var SC:URLVariables = new URLVariables(event.target.data);

[Code].....

View 1 Replies

ActionScript 2.0 :: [MX04] Referencing Multiple Movieclips With Single Variable?

Jan 25, 2009

Is there a way to reference multiple movieclips using a single variable name? For example,I'm making a side-scrolling game, and there's going to be many platforms, and I have some code that tells the player not to fall through these platforms, but I don't want to copy and paste the same "platform" code every time I add a new platform.

View 3 Replies

ActionScript 3.0 :: Removing And Adding MovieClips To/from Arrays Based On A Variable?

May 8, 2009

On my stage I have 5 items labeled item1_mc, item2_mc, item3_mc and so forth...they all have two keyframes on their respective timelines, one labeled "active" and the other "inactive". My code contains 2 arrays, inactiveArray and activeArray and a variable known as energy that regularly goes to and from 0 - 100.What I am looking to achieve is basically the function of...if energy >= "insert given items 'active threshold' 20, 40, 60, etc..." then add it to the activeArray, if it is not, remove it and add it to the inactive array.

all objects in activeArray gotoAndStop("active");
all objects in inactiveArray gotoAndStop("inactive");

I have tried many different ways of achieving this effect but I always end up with duplicates and extras or something doesn't move when it's supposed to, where it's supposed to, it just ends up into a giant cluttered mess and I start from scratch.

View 2 Replies

ActionScript 2.0 :: Flash 8 - Remove Attached MovieClips Contained In Variable

Jul 26, 2009

I need to remove some movieclips that are attached dynamically so they do not show up underneath the new movieclips that will be attached when a user clicks the next button. I've tried removeMovieClip with little success. I am able to remove one or two of them, but not all. I need all of the previously attached movies gone.

Here is the as2 for it.
PHP Code:
//Set functions
function show_movie() {
menu_mc._visible = true;
buttons_mc._visible = false;
teacherinfo_mc._visible = false;
} function displayInfo() {
[Code] .....

View 4 Replies

ActionScript 2.0 :: Moving Movieclips With MoveN Variable Doesn't Work

Aug 2, 2009

I have several movieclips which name is assigned to the variable MoveN when clicked on. But moving them with MoveN variable doesn't work.

[Code]...

View 4 Replies

ActionScript 3.0 :: Attach Eventlisteners To Dynamic Movieclips And Pass A Variable?

Dec 8, 2008

I have a mc (changeColorMc) and three movieclips. The three movieclips are created on the fly (so there could be more movieclips) and filled with a color from an Array. This works fine.

Now I want to add an eventlistener for each movieclip, so when someone push one of the movieclips the movieclip with the name "changeColorMc" gets that same color from the colorArray.

My question is: How can I pass the color value from the colorArray to the buttonPressed function? Is this possible?

I was also thinking that I had to create three buttonPressed functions ie. buttonPressed1, buttonPressed2 and buttonPressed3 and attach these to the created movieclips.. but how? Because I don't know up front how many movieclips there will be..

View 5 Replies

ActionScript 2.0 :: Flash 8 - Variable Global Level And Multiple MovieClips

Oct 31, 2007

I am writing a simple game in which the hero will need to jump on a trampoline. The thing is there are various trampolines (set as instance name tramp1, tramp2, tramp3 etc, and only one trampoline will be active at any given time. I have set a variable _global.level which decides which trampoline is active but how do I do the hit test?

So far I have:
trampland = _parent.ground.tramp2.spring.hitTest(this._x+8, this._y+32, true);
if (trampland) {go and do something}
But how do i tell which 'tramp' to use? I have been trying
_parent.ground.tramp[_global.level].spring,
But to no avail.

View 2 Replies

ActionScript 3.0 :: Loading Swf's Into MovieClips?

Jul 19, 2009

I've read that when loading swf's it's a good idea to load them into a MovieClip. Is that true, why and would a Sprite do as well. Also how is it done?I thought this would do.

var currentPage:MovieClip = new MovieClip();  var loadRequest:URLRequest = new URLRequest("home.swf");  var swfLoader:Loader = new Loader();  swfLoader.load(loadRequest);  currentPage.addChild(swfLoader);

[code].....

View 7 Replies

IDE :: Loading Movieclips From Library?

Nov 9, 2009

i used this code with linkage to load a movieclip from library using flash action script 3

btn.addEventListener(MouseEvent.MOUSE_UP,goLayersS ite);
function goLayersSite(Event)
{
var myMovieClip:MovieClip = new Tree();
empty.addChild(myMovieClip);
}

i want to know how am i able to load a flash movie clip from my current library into my stage with using a button via flash action script 2.

since im using other codes in action script 2 i can not cancel them and i really need to load a movie clip in my AS2 FLA.

View 1 Replies

ActionScript 2.0 :: [CS4] Loading Movieclips From Library Via XML

Feb 5, 2009

I'll do my best to keep this question as short as possible:

I've made 5 'fruit' movieclips and they're in my library.

And using so.addVariable("getNumber", "003"); in my HTML code, I'd like those particular fruit movieclips to play one after the other (and then loop).

I've had a look around for something similar, without luck, so I'm trying to make it from scratch. I got as far as getting it to load the first number and then the first type and url, but I'm stuck on getting to go onto the next type, also being able to define (with addVariable) which number's nodes gets played.

Here's an example of my XML to show the structure.
Code:
<?xml version="1.0" encoding="utf-8"?>
<list>
<number="001" >

[Code].....

View 1 Replies

ActionScript 3.0 :: Allow To Loading External Movieclips?

Mar 17, 2009

I'm making a game where I have a lot of movie clips that I need to load so I was wondering wheather ActionScript 3.0 allowed us to load external movieclips? Can we import an external display object (movieclip) into a display object container? Or do I have to load a .swf which contains the movieclip onto the stage? What happens if I need to pull in multiple .swf files can the movieclips overlap or will one .swf file block the user from viewing the .swf in a lower depth? Can I import the movieclip from the external .swf file from its library and add it to the main stage rather then adding the whole .swf to the main stage?

View 11 Replies

ActionScript 3.0 :: Loading And AddChild To MovieClips?

Aug 20, 2009

Basically I have this movieclip on stage that is suppose to load another movieclip from an swf. in that swf are 31 copies of the movieclip since theres no duplicateMovieclip function in as3. I am able to load and add child to the movieclips easy with this,

PHP Code:
function duplicateMovieclips():void{
for (var i=0; i<movieclipsToLoad; i++){
movieclipsDuplicated++;
entrys_mc.addChild(mcV[i]);

Below (which I excluded) are other various bits of code to edit the movieclip and what not. I can also remove it just fine with this bit of code here

PHP Code:
function removeF():void{
var repeat:int = 0;
for (var i=0; i<timesToRemove;i++){
entrys_mc.removeChild(mcV[i]);
repeat++;
movieclipsToLoad--;
if(i == timesToRemove-1){
loadSelected(); //THE PROBLEM
}}}

What this swf is trying to do is record the year and the month the user clicks on and then return every day's data from the xml if a day is filled out. when removeF(); executes, i get the error:
Code:
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
Pointing at entrys_mc.removeChild(mcV[i]);...but when its NOT there, loadSelected(); that is, it works just fine. I even put a trace statement in it. The whole if condition works fine to.

LoadSelected is the one that retrieves the text needed to load in the movieclip. whatever year and month the user selects, it loads the information of it and puts it in a string. then it displays in the dynamic text field inside the movieclip. Also, when SWF loaded it loads all 31 movieclips using this.
Code:
for (var i = 0; i < 31; i++){
var groupMC:MovieClip=MovieClip(clip.getChildByName("group" + i));
mcV.push(groupMC);
trace("repeat # = " + i);
}

View 15 Replies

ActionScript 2.0 :: Loading In Movieclips Instead Of Images

Feb 11, 2010

Loading in Movieclips instead of images

View 6 Replies

ActionScript 2.0 :: Loading & Unloading Movieclips

Aug 8, 2010

I start off my game with an empty movieclip located in the middle of the stage. I then load a movieclip using the loadMovie method. At some point I would like to unload the movieclip and then reload another one, sort of a different scene if you will. The new movieclip has a number of other nested movieclips that I will use as buttons and I have coded a function that is called that creates these buttons. Here's what it would look like:[code]The roomSetUp function contains info on how the room should look and the button codes. The problem is that the setup function runs before the new movieclip is loaded. Seems that there is no way to have Flash 'Yield' until the movieclip is loaded and then go to the last function. Any suggestions other than MovieClipLoader?

View 2 Replies

Loading Several MovieClips Into Separate Variables?

Sep 22, 2010

I have several Movie Clips in the Library which I need to be able to load and bring up on the screen randomly.The code below shows how I can load one of these, but to get a proper control ideally I would like to load them all in to an array or numbered variables so that they can be called from a simple piece of code and actioned one at a time.

My movieclips can all be called something simple like mc1, mc2, mc3, mc4 etc to make things easier.These need to be referenced in to an array mcContainer[.....] or as mcContainer1, mcContainer2........ so that they can be called easily.I just need to know the simplest way to do this and how i reference them, I have tried several ways like ["mc"+i] etc and nothing seems to work.

Code:

var mc:mcLogo=new mcLogo();
addChild(mc);

View 4 Replies

ActionScript 3.0 :: Loading Movieclips From The Library?

Feb 25, 2010

I have several buttons that on mouse over will load a library movie clip. I want that movieclip to load on top of everything then once it's played allow me to either replay that movieclip by hovering over the button again or play a different movieclip by hovering over another button etc etc. with the ability to repeat this.
 
My code below currently loads my movieclip on top in hte corerct place however wont allow me to hover over another button and only plays once: var my_packages_mc:MovieClip = new packages_mc();var my_treatments_mc:MovieClip = new treatments_mc();

[Code]...

View 1 Replies

ActionScript 2.0 :: Loading Movieclips From Library Via XML?

Feb 5, 2009

I've made 5 'fruit' movieclips and they're in my library.And using so.addVariable("getNumber", "003"); in my HTML code, I'd like those particular fruit movieclips to play one after the other (and then loop).I've had a look around for something similar, without luck, so I'm trying to make it from scratch. I got as far as getting it to load the first number and then the first type and url, but I'm stuck on getting to go onto the next type, also being able to define (with addVariable) which number's nodes gets played.[Code]....

View 4 Replies

ActionScript 3.0 :: Loading And Scaling MovieClips?

Sep 15, 2010

I'm loading an external SWF file, which become a MovieClip, using Loader(). That part is working fine. I then need to scale the MovieClip to match the stage, so that when I set the width and height of the movie doing the loading in SWFobject, the MovieClip will scale too.

For example, the SWF being loaded may be 320x240, but we decide later that we want it to be 640x480 on the page. We can just change the width and height in the javascript call to SWFobject, and it should scale everything. To top it off, I'll need an AS2 version too because we might need to load AS2 SWFs.

[Code]...

View 3 Replies







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