Dynamic Reference For Movieclips
I have read several examples both on the web and in the Adobe help files regarding dynamic referencing.
I cannot get Actionscript to recognize a dynamically named clip such as in the attached for loop.
Any suggestions as to why thumbCan[thumbMC+i] returns undefined and therfore doesn't allow anything to be loaded?
Attach Code
for (i = 0; i < mainArr.length; i++) {
thumbCan.createEmptyMovieClip("thumbMC"+i, thumbCan.getNextHighestDepth());
trace("trace1= "+thumbCan[thumbMC+i]); // returns undefined
trace("trace2= "+thumbCan); // returns _level0.thumbCan as expected
daLoader.loadClip(mainArr[i][0], thumbCan[thumbMC+i]);
}
Adobe > ActionScript 1 and 2
Posted on: 03/25/2008 12:24:33 PM
View Complete Forum Thread with Replies
Sponsored Links:
Dynamic Reference To MovieClips
I have an array containing names (as strings) of already existing MovieClips, array=["a1","a2","a3",...].
Is it possible to refer to a MovieClip using the content of an array?
For example I would like to load the MovieClip "a1" into a blank MovieClip placed on the stage. How can I load the MovieClip using array[0] as a reference?
Obviously MovieClip.attachMovie(array[0]) does not work..
Any ideas?
View Replies !
View Related
How Do You Reference Other Movieclips
How do you reference other Movieclips? I'm coming back from a flash vacation and I don't remember anything.
For example, if I were to have the following code, the result is perfect.
Code:
on (rollOver) {
this._alpha = 50;
}
What I can't find out is how to reference other Movieclips, like
Code:
on (rollOver) {
this._alpha = 50;
someotherMC._alpha = 50;
}
The movie clip that I wish to affect is in another layer, if that helps.
View Replies !
View Related
Reference Child Movieclips
I have 5 moviecips inside a main movieclip.
_cn (main cclip) and _gl0,_gl1,_gl2,_gl3,_gl4 .. inside the main clip.
i want to refer to the clild clip inside a function .. how to do that.
for example .. as below,
Code:
function _xx(_num){
trace(this['cn']); // works fine
trace(_cn.this['_gl'+_num+'']); // error
}
_xx(3);
View Replies !
View Related
Dynamically Reference Multiple MovieClips
I'm looking for a concise way to dynamically change the widths of 12 Movie Clips. Let's say they're named mc1, mc2, mc3, etc. Is there a way I can loop through these instance names, referencing them dynamically?
This is what I'm talking about, obviously it doesn't work:
for(i=1;i<=12;i++){
"mc"+i+"._width"-=2;
}
Trying to avoid:
function changeWidth(){
mc1._width-=2;
mc2._width-=2;
mc3._width-=2;
etc...
}
View Replies !
View Related
Null Object Reference With Nested Movieclips
I've been struggling with this issue for a couple of days now, please someone help me out. Basically all I want to do is change the frame of a nested movieclip and flash is getting a null object reference and crashing. This seems like it should be a very simple thing to do in flash, but it is not. I have a movieclip linked to a class which I am attaching via code, that is working no problem. Inside of this clip is another clip with an instance name. As long as the outer movieclip is at frame 1, I can access the inner clip. However if the outer clip is at another frame number the inner clip will not be accessible.
I have created a quick little file which illustrates the problem. In the file there are 2 instances of a movieclip, called test1_mc and test2_mc. Inside this movieclip are 4 different frames, each one with a different box movieclip (a box with the text "1", "2", etc). Each one of these numbered box movieclips are given a different instance name, box1_mc, box2_mc, etc. This inner movieclip also has 4 different frames on it (with different colors). If the outer clip (test1_mc) is at frame 1 then you can access the inner clip (box1_mc) as you would expect (test1_mc.box1_mc). However if the outer clip is on any other frame the inner clip is null. If I check the numChildren, it still traces out 1, but then tracing getChildAt(0) is null. I don't get it.
Below is the code that causes the error:
Click here to download the FLA file
Code:
test1_mc.gotoAndStop(1);
test1_mc.box1_mc.gotoAndStop(3);
trace("test 1 child num: " + test1_mc.numChildren);
var child1 = test1_mc.getChildAt(0);
trace("test 1 child = " + child1);
trace("child 1 name = " + child1.name);
//
test2_mc.gotoAndStop(2);
trace("test 2 child num: " + test2_mc.numChildren);
var child2 = test2_mc.getChildAt(0);
trace("test 2 child = " + child2);
//
trace(" - - - display list - - -");
traceDisplayList(stage);
This file traces out the following:
Code:
test 1 child num: 1
test 1 child = [object MovieClip]
child 1 name = box1_mc
test 2 child num: 1
test 2 child = null
- - - display list - - -
[object MainTimeline] root1
[object TestMovieclip_1] test1_mc
[object MovieClip] box1_mc
[object Shape] instance1
[object StaticText] instance2
[object TestMovieclip_1] test2_mc
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at NestedMovieclips_fla::MainTimeline/traceDisplayList()
at NestedMovieclips_fla::MainTimeline/traceDisplayList()
at NestedMovieclips_fla::MainTimeline/traceDisplayList()
at NestedMovieclips_fla::MainTimeline/NestedMovieclips_fla::frame1()
Notice how the test2_mc numChildren is equal to 1, yet getChildAt(0) is null. I think the is the crux of the problem. Honestly, this is looking like a bug in flash9, because the crash happens even if you just traverse the display list as shown above. How is it possible that something that is displayed on the screen could be null? Or in other words, how could can an object exist on the display list, be physically on the screen, and yet be null. If anyone can give me a work around or explain what is happening here, it will be greatly appreciated.
View Replies !
View Related
Dynamic Reference.
Hi all, I hope I'm able to explain exactly what my problem is.
I'm doing a poker game. I have a set of 52 mc's (the cards with movement effects) inside a mc (the container used to reference to the cards). I have 5 instance of the container mc in the root. I need to start the card mc inside the container mc, but i can't.
Example:
the fice instances on the table are called Card0, Card1 etc.. The card mc inside each instance of the container mc are called "ac", "2c", "3c", etc.
var = "ac" (this is randomly taken from an array of cards!)
I need something like: _root["card" + i].var.play()
But it does not work.
I hope it's clear. And sorry for my English!
Thanks.
View Replies !
View Related
Dynamic XML Reference
Hey,
is it possible to make a dynamic xml reference?
With dynamic reference I mean something like the following. Say you have a XML file with translations:
Code:
<?xml version="1.0" encoding="utf-8"?>
<Vertalingen>
<Pages>
<Page titel="Algemeen">
<Terms>
<PageTerm term="Help">
<NE>Help</NE>
<EN>Help</EN>
<GE />
<FR />
</PageTerm>
<PageTerm term="Next">
<NE>Volgende</NE>
<EN>Next</EN>
<GE>Nachten</GE>
<FR>Volgende in het Frans</FR>
</PageTerm>
<PageTerm term="Save">
<NE>Opslaan</NE>
<EN>Save</EN>
<GE>Opslaan in Duits</GE>
<FR>Opslaan in Frans</FR>
</PageTerm>
</Terms>
</Page>
</Pages>
</Vertalingen>
I want to get the right translation for a certain word by using the following functions:
ActionScript Code:
function LoadXML(e:Event):void {
xmlData = new XML(e.target.data);
ParseXML(xmlData, "Algemeen","Help","NE");
}
function ParseXML(Data:XML, sPage:String, sTerm:String, sTaal:String):void {
Data.Pages.rPage.(@titel == sPage).Terms.PageTerm.(@term == sTerm).NE.text()
}
My question is this: how can I get the right translation out of this XML? With my reference above I get the Dutch translation, but I want the translation of the language given in the variable sTaal, so something like this:
ActionScript Code:
this[" Data.Pages.rPage.(@titel == sPage).Terms.PageTerm.(@term == sTerm)." + sTaal + ".text()"]
But this particular reference doesn't work. How can I make it work, so I get the right translation?
View Replies !
View Related
Dynamic Reference To Dynamic Text?
I'm trying to find a way to add code to my LoadVars object that will allow me to retrieve a specific variable in my TXT/DAT file, without going through and hardcoding a switch statement that covers all the possibilities. I have my variables in the TXT/DAT file numbered 1-N, and want to be able to select my text and display it based on a number defined by other buttons. So, I'm looking for something that would sort of accomplish what this would (if it worked)
Code:
textBox = _parent.defHolder.(_parent.defNum //the variable names in the TXT file and defNum are the same)
I'm sure that that's fairly understandable...though it doesn't work. I can't create a _global variable either...well, I can, but it doesn't make any difference. Is there a way to insert a dynamic variable after my LoadVars object, or am I going to just have to go ahead and put the Switch in with a Case for each variable?
Thanks for any help.
View Replies !
View Related
Dynamic Reference To Clips?
my problem in short is this:
i've got a photographers portfolio with a bunch of photos.
i've set up the photos as movies in different layers,
because they fade in and out as animations.
the header jumps on the timeline to specific frames
(with next/previous-buttons and section buttons).
when it jumps to let's say from frame 12 to frame 23
i want picture 23 to fade in and 12 to fade out.
how do i get the script to do this, withou having to write
a separate script on each frame?
in other words, how do i get the frame numbers to determine
which movie clips to fade in/out?
if there's a better way to do this, suggest it, too...
-----
the script so far looks something like this:
var thisFrame; // the frame where we are now
var fromFrame; // the frame where we came from
thisFrame = _root.pix._currentframe; // the frame where we came to
_root.pix.?????.gotoAndPlay("in"); // in comes the new pic
_root.pix.?????.gotoAndPlay("out"); // out goes the previous pic
// ????? = here i've tried to combine the word "clip" and the thisFrame/framFrame variables to get it to play movie clip instances like pic1, pic2, pic3...
don't now how to do it.
fromFrame = thisFrame; // when we go to the next frame, it nows where we're coming from
-----
bonus question:
if i have a line of script on a long timeline (where we move forward and backwords) one step at the time. how do i get the script to load everytime we enter a frame?
View Replies !
View Related
Can't Reference Dynamic Textbox?
This is how my project is set up:
I have a "Navigation.swf" that contains a MovieClip (MC) called "content". I load all of the individual .swfs inside of "content". We'Il call the imported .swf "Imported.swf".
I am trying to have it set up so that when the user drags one object onto another object it will display a message in a dynamic textbox. All of these items are located on the main timeline of the "Imported.swf". I have no problem referencing the movie clips (_root.content.<MCname> ), but I have tried several combinations and could not figure out how to path to the variable name of the dynamic text boxes. I know it works because i set it up to run by itself (not loaded into "content") and it works fine.
Any suggestions would be VERY appreciated.
Thanks!
View Replies !
View Related
Dynamic Reference To Clip
I am having a syntax problem with a bit of actionscript.
Shouldn't this statement:
_root.majorMask.masterMC.maskFaces.neg1.createEmpt yMovieClip(nm,i);
Equal this one?:
wclip = maskFaces;
cname = _root.majorMask.masterMC[wclip].neg1;
[cname].createEmptyMovieClip(nm,i);
View Replies !
View Related
Dynamic Reference To Timeline
I am trying to learn AS 2.0 from using AS 1.0 for, well ever...
I was very used to creating dynamic references to key timelines by using code like:
_global.currentMc = this
AS 2.0 deprecated _global in favour of a class property to hold all 'global' properties like, for example a AppStartupSettings class that holds all user-defined constants.
My question is this... I have created a 'Globals.as' file and have the following code in it:
class Globals {
public static var ROOT:String = this;
}
It is a kind of guess, but I realise that this can't be right, however, I can't figure out how else to go about it.
Can anyone help?
View Replies !
View Related
Dynamic Reference To Textfield's Name
Hello! I am very new at AS and would appreciate your help
How can I access the text property of a textfield using a variable in place of the textfield's name?
ex:
var textf:String;
textf="text1";
//in place of this:
//text1.text="aaaaaaa";
// something like :
textf.text="aaaaaaa";
Thks,
ZC
View Replies !
View Related
Dynamic Object Reference
I am the webmaster at http://eric.steveneaton.com/. I am workign on a game called Marco's Polo's. I'll spare the extreme details here, but I was bulding an inventory class (Inv). I want to have some way to take a string like "slot0" in a variable and use it to access an object called slot0. A book I read used something similiar, "_root[name]._x = whatever" to loop though any number n of movie clips in the storyline. Is there syntax that translates to classes?
View Replies !
View Related
Dynamic Variable Reference
I have some variables called
_root.name1
_root.name2
_root.name3
_root.name4
I want to initiate the three variables by refering to them dynamically.
Here is my script, which is not working (The variables never get any value):
Code:
for (var i = 0; i<7; i++) {
if (i%2 == 0) {
var temp = "name"+((i+2)/2);
_root[temp] = my_array[i];
}
}
How do I refer to the variables dynamically?
View Replies !
View Related
Reference Dynamic Elements By Name
getChildByName("name") works great if my object has been added to the stage or some MC. But what can I do if I have an object created dynamically that I want to reference later in the code but haven't added to the stage? Here's an example:
Quote:
for (var a = 0; a < 10; a++) {
var testObject = addChild(new BlankMC());
testObject.name = "myTest_" + a;
}
// later in the code
var someItem = getChildByName("myTest_3");
trace(someItem);
This returns my BlankMC instance, but ONLY because it was added to the stage. If I don't use "addChild", then I get "null" because my instance is not a child of the stage (or anything else as far as I know). Is getChildByName the ONLY function for referencing a dynamic element?
View Replies !
View Related
---> Can't Reference A Nested Dynamic Textbox?
This is how my project is set up:
I have a "Navigation.swf" that contains a MovieClip (MC) called "content". I load all of the individual .swfs inside of "content". We'Il call the imported .swf "Imported.swf".
I am trying to have it set up so that when the user drags one object onto another object it will display a message in a dynamic textbox. All of these items are located on the main timeline of the "Imported.swf". I have no problem referencing the movie clips (_root.content.<MCname> ), but I have tried several combinations and could not figure out how to path to the variable name of the dynamic text boxes. I know it works because i set it up to run by itself (not loaded into "content") and it works fine.
Any suggestions would be VERY appreciated.
Thanks!
View Replies !
View Related
Reference Dynamic Text Variable
How can I reference a dynamic text thats embedded in a movie clip.
In another words I want to reuse a movie clip that has an instance of
a dynamic text box. Do I use something like mcName.txtInstanceName, where the txtIntanceName is always the same by the movie clip instance name changes? Is this possible?
View Replies !
View Related
[F8] Dynamic Text Loading Reference
Hi,
I've hit a wall with this and would really appreciate any help. It seems like it should be simple.
I have three swfs: main, slides, refs.
Main loads slides (level5) and if the user wants, they can click a button in slides and load refs (level 101).
That part works :-)
What doesn't work is the loading of text in refs.
When refs swf is loaded, it should pull text from the same text file that loads into slides. This works if the refs swf is already open and the Next Slide button is clicked but of course that sends the user to the next slide and pulls the refs for that slide.
So it seems I have it right in the Next Slide button code but need to modify that (so it loads the text but doesn't change the slide) for the refs button.
The Next Slide code is in the slides .swf:
Code:
this.nextSlideBtn.onRelease = function () {
if (curFrameNum < Number(slideInfoLV.totalFrames) - 1 {
curFrameNum++;
} else curFrameNum = 0;
loadFrame();
slideCounter();
}
The loadFrame function and slideCounter functions are also in the slide swf:
Code:
function loadFrame() {
_level0.myRefs.load(slides/slide" + curFrameNum + ".text");
The myRefs variable is in main swf:
Code:
var myRefs:LoadVarsc = new LoadVars();
myLVrefs.onLoad = function (success:Boolean) {
if (success) {
_level101.loadedRefs.htmlText = myLVrefs.refs;
} else {
_level101.loadedRefs.text = "Huston we have a problem.";
}
}
Thanks for your help!
View Replies !
View Related
Dynamic Reference To Array Or XML List Name
Hey guys
How do I make a dynamic pointer/reference to an XMLlist or Array?I thought something like below, but it doesn't work
Code:
var i:Num = 0;
var ListPointer:String = "ObjectListNameIReallyWantToAccess";
trace ([ListPointer][i].@id); //should trace id of first object in my XMLList called 'ObjectListNameIReallyWantToAccess', right?
I can successfully access ObjectListNameIReallyWantToAccess[i].@id if I don't make the XML name dynamic, so that's all set up correctly. I've tried declaring ListPointer with and without quotes.
Is [].[] correct formatting?
Any ideas about what I'm doing wrong?
Cheers
View Replies !
View Related
Dynamic MovieClip Path Reference
Hey everybody,
i'm currently writing an actionscript class which extends the movie clip class. The class creates some new movieclips depending on the properties set on the instance of the class. In the class i have the following function to fetch the depth of a newly created instance..., but it doesn't work. I have rewritten this thing a billion times but for some reason i just cant seem to get it to work.
inside the class:
Code:
private function setDepht(target:Array){
if(target){
var path:String = new String("");
for(var i in target){
path += "."+target[i];
}
this.depth = [path].getNextHighestDepth();
}else{
this.depth = _root.getNextHighestDepth();
}
}
the function is called like this: this.setDepth(new Array([_root], ["somemovieclip_mc"],["someotherMc_mc"]));
What is this deal with dynamic paths in AS?
Thanx in advance
Marijntje
View Replies !
View Related
How Do We Reference Dynamic Array Values?
For example, I have :
Code:
_root["shape1materials"+a+"col3box"+m]=String(_root["comboThickness"+a][i]);
I can't figure out how to reference the array dynamically using square brackets and then call the content of the array again using square brackets...
What is the recommended way to get around this?
Leon
View Replies !
View Related
Dynamic Array Of Buttons - Reference Problems
Hi..
I have a movie clip on the stage called buttons, and within this is another movie clip called button, and in this is a button. So buttons>button>actual button.
I duplicate the button movie clip several times so that I basically have an array of button movie clips within the buttons movie clip.
The thing is I want each of these buttons to perform a different action..eg set a variable to 1,2,3 or 4.
I can reference the duplicated button movie clips eg _root.buttons.button1 but I dunno how I can communicate with the button if that makes sense..or get it to change a variable depending on which movie clip it's in..
Any help would be really appreciated
Thanks..
View Replies !
View Related
Dynamic Nested Movieclip Generation&reference
ive been fighting with this for a while,
i must be close, but saddly not quiet close enough.
broad goal:
to make a drop down menu system that generates based on the all the directories/ sub directories in a folder.
intended technique:
perlscript> xml> flashmx
im unfamiliar with perl so in the mean time ive just manually created the xml file. all is going well up to the point when i try to automatically make my movie clips. (eventually to become my buttons)if there is a more direct technique sing out now?
problem:
for each xml node ive made an array consisting of all its parents, this will become my nested movieclip path. unfortunately if the movieclip doesnt exist at the time the reference to it is declared the variable type is a string rather than a movieclip (reference).
Code:
lister = ["menu","box","shoe","cat"];
if (this.[lister[0]] == undefined){
this.createEmptyMovieClip(lister[0]+"_mc",1);
_global.path = lister[0]+"_mc";
}
for (i=0;i<lister.length-1;i++){
//attempt at describing the path
_global.path = ((lister.slice(0,i+1)).join("_mc."))+"_mc";
currentName = lister[i+1];
_root[_global.path].createEmptyMovieClip (currentName+"_mc",i+1);
// alternative for setting path replacing the above line
//_global.path = (_root[_global.path].createEmptyMovieClip
(currentName+"_mc",i+1));
//yet another alternative for setting path
//_global.path = _global.path+"."+currentName+"_mc;
//and some traces to prove im vaguely on the right track
//trace ("_global.path = "+global.path );
//trace ("currentName = " + currentName);
}
none of these are working properly,
menu and menu.box are created properly, but after that it all fails.
if anyone feels confident have a peek any assistance would be hugely appreciated. thanks
ps: i dont have flash on this machine, so there may be some spelling errors in my code....
View Replies !
View Related
HARD: Dynamic Reference Creating Object
Hello,
I have a few classes to set card games, and I am experiencing a problem when I try to create the objects by referenciating them dynamically (I got a syntax error). Look at the snipet of the code where the error happens:
Code:
for (var z=1;z<=mydeck._totalcards;z++)
{
var _root["card"+z]:Card = new Card(); // problem happens in this line
_root["card"+z].newCardFromDeck(mydeck,"card"+z,z-1);
}
Any clues?
View Replies !
View Related
[CS3] Have Dynamic Textbox Reference A.txt File Array
Hello
I am trying to import text from a course.txt file array into a swf which already dynamically loads the text into another file. Currently the text is:
var vo = "Here is the text for page 1.";
_root.shell_mc.v_over.v_txt.text = vo;This code would be to a series of pages to reference the text of different pages. Instead of the " var vo = "Here is the text for page 1."; " part, I would like for the 'var vo' to reference a section of an array in a course.txt file. My initial set up of the course.txt file has it reading:
arrayNum=2&
&myScrollText00=Here is the text for page 1.&
&myScrollText01=Here is the text to reference for page 2.&
...Can anyone help me figure out how to write the code for this?
View Replies !
View Related
AS2.0: Reference Dynamic Movie Clips In A Loop
Hi
If I changed this code so that the movie clips were created via a for loop:
Code:
this.createEmptyMovieClip("loadedimage1", this.getNextHighestDepth());
this.createEmptyMovieClip("loadedimage2", this.getNextHighestDepth());
this.createEmptyMovieClip("loadedimage3", this.getNextHighestDepth());
this.createEmptyMovieClip("loadedimage4", this.getNextHighestDepth());
How would I then reference these movie clips in a for loop again?
View Replies !
View Related
Dynamic Movie Clip Reference Problems
Last edited by Codemonkey : 2006-08-18 at 10:30.
i'm trying to convert the following statement:
ActionScript Code:
line_mc_1.moveTo(end_mc_1._x , 353);
I'd like to replace "mc_1" with the variable "currentSWF". by doing this:
ActionScript Code:
whichLine = "line_" + currentSWF;
whichEndX = "end_" + currentSWF + "._x";
eval(whichLine).lineTo(eval(whichEndX), 353);
...only the first eval is working. Is there a better way of doing this? I'm basically trying to dynamically generate the reference to the MC property. I've tried other approaches with no success.
Thanks in advance!
Raphael
View Replies !
View Related
Dynamic Movie Clip Reference, Invoke Function In Mc
Happy new year all!!
I'd like to invoke a function inside a mc from it's parent, but I want to have the reference to the clip be dynamic. When I path the mc directly and invoke the function it works, how would I make that same reference work dynamically.
Here's a sample of what I'm trying to do:
Code:
var myArr:Array = new Array();
myArr[0] = "galleryContainer_mc.eventGallery1_mc.imgContainer_mc";
trace(myArr[0]);
// This works
toggle_btn.onRelease = function() {
galleryContainer_mc.eventGallery1_mc.imgContainer_mc.videoToggle();
}
// But this doesn't work
toggle_btn.onRelease = function() {
myArr[0].videoToggle();
}
I know I'm fried, but that seems like it should work, am I missing something really basic here? Any advice would be really helpful at this point. Thanks!
View Replies !
View Related
[Flash 8] Dynamic Movieclips With Dynamic Movie Clips : Help
Hello, is there a way to:
1. create an empty movieclip (zone1)
2. create a movieclip in zone1 (zone1.contentMC)
3. create an empty mask movieclip in zone1 (zone1.maskMC)
4. draw a filled rectangle into zone1.maskMC
5. set the zone1.maskMC as the mask for zone1.contentMC
6. load content at any time into zone1.contentMC
I just spent 15 minutes putting together a post only to have it say I was not logged in (session timeout I guess).. lost the post data on backspace. Here is the code I'm working with.. as you can see with the comments I've been at this for a while. I want to iterate through zone array.. setup empty movies.. then a contents and mask movie inside each movie, draw a rectangle in the mask movie and then set the mask before I put contents into the content MC.
Code:
stop();
var colorArray:Array = new Array("0xFF0000", "0x0000FF", "0x00FF00");
function drawRec(endX, endY, targetMovie:MovieClip) {
trace("drawing a mask in "+targetMovie+" with "+endX+", "+endY);
rndColor = Math.round(2*Math.random());
targetMovie.beginFill(colorArray[rndColor], 100);
targetMovie.moveTo(0, 0);
targetMovie.lineTo(endX, 0);
targetMovie.lineTo(endX, endY);
targetMovie.lineTo(0, endY);
targetMovie.lineTo(0, 0);
targetMovie.endFill();
}
function makeZones() {
atZone = 0;
for (zones in zoneArray) {
// create zone movie
this.createEmptyMovieClip("zone"+atZone, this.getNextHighestDepth());
// move new zone to it's correct x and y
this["zone"+atZone]._x = zoneArray[zones][0];
this["zone"+atZone]._y = zoneArray[zones][1];
// create contentMC
this["zone"+atZone].createEmptyMovieClip("contentMC",1 );
trace(this["zone"+atZone].contentMC);
// create Mask
this["zone"+atZone].createEmptyMovieClip("maskMC", 2);
trace(this["zone"+atZone].maskMC);
//draw Mask
drawRec(zoneArray[zones][2], zoneArray[zones][3], this["zone"+atZone].maskMC);
contentMC.setMask(maskMC);
loadMovie("images/0.jpg", contentMC);
//set the mask for the zones contentMC
atZone++;
}
}
var zoneArray:Array = new Array();
zoneArray[0] = (Array(0, 0, 250, 250));
zoneArray[1] = (Array(250, 0, 500, 250));
zoneArray[3] = (Array(0, 250, 500, 500));
//trace(zoneArray[0][0]);
makeZones();
View Replies !
View Related
Help With Dynamic Movieclips
Hi,
I'm attempting to build a flash movie that can dynamically load in external images into empty movie clips.. which need to load into a scrollpane and also be clickable.
So far my code for generating the movie clips and loading the images looks like:
Code:
depth = 5;
y = 10;
for (i=0; i<total; i++) {
categoryNum = xmlNode.childNodes[0].childNodes[i].attributes.value;
createEmptyMovieClip("categoryImage" + i, depth);
_root["categoryImage" + i]._x = 670;
_root["categoryImage" + i]._y = y;
loadMovie("category_images/" + categoryNum + ".jpg", "categoryImage" + i);
_root["categoryImage" + i].onRelease=function(){
trace("HIT");
}
depth++;
y+=90;
}
This creates a nice vertical line of my images, lined up where I want it in the main movie.
My questions are:
1) How do I make the movieclips clickable?? You will see that I have code in there for an onRelease(), but it doesn't seem to do anything.
2) How would I go about loading these clips into a scollpane?
View Replies !
View Related
Help With Dynamic MovieClips
Hello.
I don´t know much about flash, so I`m gonna need a little help here:
I've got two questions:
1- ¿How can I drag differents dynamic movie clips at the same time?
2- ¿How can I Create dynamic movie clips into some others? I've allready tried with createEmptyMovieClip and with attach, but it doesn't work out.
Thanks.
Gracias.
View Replies !
View Related
XML & Dynamic Movieclips
Hi Everyone I need your help, I just can't do this work, I've created a mask, inside i have movieclips that loads XML, but I need these movieclips been created dynamically, according with the XMLNodes at the same time that when I make a RollOver on one MovieClip the Info (XML) appears in the main dynamic text called "text_load".
On frame 14 i have basically all the scripts i need to do, but it doesn't work. The next frames are the same.
Please Help... I've been trying for many days, and I can't, i'm new at actionscript
I've attached the example.
View Replies !
View Related
Dynamic Movieclips From Xml AS3
hi, below is some code I am using to load buttons from an xml doc, the xml part is working and the buttons are place on the stage. I am having trouble with accesssing the individual movie clips. in the function showtitle you will see the error messages I get. I am assigning the names a0, a1 and a2 to the movieclips if I use a trace statement in marker it gives the movieclips names as being a0 a1 and a2.. I am really stump please help.
function mytest(){
for(i=0; i < mainXML.channel.length(); i++){
var myMC:MovieClip = new marker;
trace(mainXML.channel[i].title.text());
myMC.name = "a" + i;
txt_mc.addChild(myMC);
myMC.x = mainXML.channel[i].testx.text();
myMC.y = mainXML.channel[i].testy.text();
myMC.test_txt.text = mainXML.channel[i].title.text();
myMC.test_txt.visible = false;
if(myMC.name=="a1"){
myMC.test_txt.visible = true;
myMC.addEventListener(MouseEvent.MOUSE_OVER, showtitle);
}
trace(myMC.name)
//trace a0
// a1
// a2
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////
function showtitle(event:MouseEvent):void {
trace(txt_mc.a1.test_txt.text)
//////////error message
//TypeError: Error #1010: A term is undefined and has no properties.
//at southamerica_3_fla::MainTimeline/showtitle()
txt_mc.a1.test_txt.visible = false;
/////////error message
// access of undifined property a1
//a1.test_txt.visible = false;
}
View Replies !
View Related
Dynamic Movieclips
Hi
I am writing an application which manipulates triangles and squares. I wish to give user control to the number of triangles and sqaures created and allow the user to manipulate each object.
Now I am using attachmovieclip e.g.
_level0.attachMovie("MyTRA_mc_link", MyMc, _level0.getNextHighestDepth(), {_x:412.5, _y:225, _alpha:78});
and i have a list of names an array which allow me to name up to 26 variables - MCA, MCB, MCC ... MCZ.
Now the user functions i have are:
use of THIS for drag and drop
then to move x or y or rotate i have to write the actual code for each function so i have MOVE_MCA(key_press), which is selected by a case statement and then depending on the key pressed i have movement in x, y or a roatation.
Now my question is - is their a simplier and more dynamic way to do this. I tried writing functions which use the movieclip as a function but could not get this to work ?
View Replies !
View Related
Dynamic Movieclips
Hi all,
I want to create a dynamic slideshow that change images by it self.
It must be somethink linke this:
It have to load an jpeg and make it visible. While the jpeg A is visible, flash have to load in background a jpeg B. Flash must check when the jpeg B is loaded, and than fade from the jpeg A to jpeg B and so on for jpeg C, D ...
I thout to make by action cript an empty movieClip in which flash loads the jpeg A. Then I make a second empty movie clip via actionScript, that loads the jpeg B in background...
Now i have a problem, i don't know how to make them fade...how to tell to flash that he must change the jpeg A with the jpg B. He must in some way sobstitute the forts movieClip with the second...
Anyone knows how to do this?
View Replies !
View Related
Help With Dynamic Movieclips
Hi,
I'm attempting to build a flash movie that can dynamically load in external images into empty movie clips.. which need to load into a scrollpane and also be clickable.
So far my code for generating the movie clips and loading the images looks like:
Code:
depth = 5;
y = 10;
for (i=0; i<total; i++) {
categoryNum = xmlNode.childNodes[0].childNodes[i].attributes.value;
createEmptyMovieClip("categoryImage" + i, depth);
_root["categoryImage" + i]._x = 670;
_root["categoryImage" + i]._y = y;
loadMovie("category_images/" + categoryNum + ".jpg", "categoryImage" + i);
_root["categoryImage" + i].onRelease=function(){
trace("HIT");
}
depth++;
y+=90;
}
This creates a nice vertical line of my images, lined up where I want it in the main movie.
My questions are:
1) How do I make the movieclips clickable?? You will see that I have code in there for an onRelease(), but it doesn't seem to do anything.
2) How would I go about loading these clips into a scollpane?
Basically what I want to end up with is dipicted in the jpg I'm attaching to this message.
View Replies !
View Related
Dynamic Movieclips
Hi all,
I want to create a dynamic slideshow that change images by it self.
It must be somethink linke this:
It have to load an jpeg and make it visible. While the jpeg A is visible, flash have to load in background a jpeg B. Flash must check when the jpeg B is loaded, and than fade from the jpeg A to jpeg B and so on for jpeg C, D ...
I thout to make by action cript an empty movieClip in which flash loads the jpeg A. Then I make a second empty movie clip via actionScript, that loads the jpeg B in background...
Now i have a problem, i don't know how to make them fade...how to tell to flash that he must change the jpeg A with the jpg B. He must in some way sobstitute the forts movieClip with the second...
Anyone knows how to do this?
View Replies !
View Related
Have Your Say: Dynamic Movieclips
hello everyone,
can i get some of your input on a project i'm about to embark on.
to better understand what i need to accomplish,take a look at this , its a flash page i setup to show you what i want to do.
i'm looking for directions, 'try this', 'its better if you do this', 'take a look at this code', etc.etc.
thanks for reading.
View Replies !
View Related
Hittest With Dynamic Movieclips
I'm duplicating movieclips by code and on the stage is a box where the users can drag an object to. Now I want to check if object[n] is in the box.
I used the following till now, in the object there is a button which handles the drag operation. On release I send the a parameter (_parent._name) to a function on stage:
function checkHit(name) {
check = name.hitTest(box);
}
this doesn't work. What am I doing wrong?
View Replies !
View Related
Put Dynamic MovieClips Behind A Static One
I need to put a static MovieClip to the front. It should placed in front of some MovieClips which are generated dynamically on the levels 0 to 399.
I tried different ways:
- tell the static MCs to go to the front like this
...
for (var i=0; i<imax; i++) {
duplicateMovieClip(dynamicMC, "dynamicMC"+i, i);
dynamicMC[i] = _root["dynamicMC"+i];
_root.staticMC.swapDepths(dynamicMC[i]);
}
...
> it didn't work
- put all the dynamic MCs in another MC and put the static MC in front of it > it didn't work
Has someone an idea?
thx. Maike
View Replies !
View Related
Dynamic Text In MovieClips
Hey Folks,
I need some help. I'm using a game with multiple movieclips at very high level depths using the .swapDepths() command. It is essential that I use these movieclips in my Flash file. However, they overlap my dynamic text used for scoring etc. in my game. Is there any way to put WORKING dynamic text in a movieclip, or to put dynamic text on a layer above movieclips of depth 100+?
Thanks!
Loydog
View Replies !
View Related
Dynamic MovieClips And Loading Them
i want to create a dynamic movieClip
and then load into it an swf file!
i did this :
PHP Code:
_root.createEmptyMovieClip("myScroll",0);
_root.loadMovie("townScroll.swf","myScroll");
and in the layer aboe the layer with the code i have 2 buttons
the problem is that when the movieClip is loaded the buttons for some reason is under the loaded MC!!!!!
what to do?
thanks in advance
peleg
View Replies !
View Related
Movieclips Dynamic Creation
Hi all,
I need an algorithm to create a number of empty MovieClips in "_root" acording to a variable value. Later, I will use the LoadMovie method to fill those empty MovieClips.
I´ve tried with "createEmptyMovieClip" and "AttachMovie"...
i.e.
_root.createEmptyMovieClip("EmptyMovie","MyMovie_1 ",0);
...and a few lines later...
_root.createEmptyMovieClip("EmptyMovie","MyMovie_2 ",0);
but only the last Movie, "MyMovie_2" remains on "_root".
What I'd like to do is to use that Method inside a "for" loop, for creating an array of clips with a variable legth.
THANKS!!
View Replies !
View Related
Dynamic MovieClips Question
I need to pull in information (from an XML file) about where to place a bunch of dots onto a map of the U.S. This isn't difficult except for the fact that I'm not sure of the best way to dynamically create all the dots. There isn't a set number of them. It just depends on the XML file.
Basically I need help with how to create this code.
I'm sure it'd be something like: map.attachMovieClip(....
But the problem is that I need multiple dots on the screen and I don't know how to set them into different places (not unless I did: map.dot1._x=50; map.dot2._x and so on. How do you dynamically mess with MovieClips that you create with actionscript?
View Replies !
View Related
Scrolling Dynamic MovieClips
Im having the problem of doom, would really appreciate anything you guys can suggest.
Basically, I have a movieClip holder on stage called holder_mc
I am using this code:
Quote:
int_Depth = 0;
createHolders = function () {
for (i=0; i<100; i++) {
int_Depth++;
var movieRef = _root.holder_mc.attachMovie("frame"+i+"_mc", "loadedFrame"+i+"_mc", int_Depth);
movieRef._x = i*560;
movieRef._y = 25;
//trace("int_Depth ="+int_Depth);
}
};
createHolders();
to dynamically pick out a list of movieClips from the library entitled frame1_mc, frame2_mc, etc etc.
They are positioned relative to each other and could potentially be HUGE. So i need some scrolling shenanigans implemented.
I toyed with the following code on a scroll left button to no avail.
Quote:
on (release) {
holderWidth = _root.holder_mc._width;
startX = _root.holder_mc._x;
maxScroll = startX+holderWidth;
minScroll = 0;
trace(maxScroll);
if (_root.holder_mc._x>maxScroll) {
_root.holder_mc._x = _root.holder_mc._x+50;
}
trace(holderWidth);
}
The movieClip currently scrolls well past the integer of maxScroll.
Anyone know any better way of acheiving this scrolling effect?
Know what im doing wrong?
thanks in advance.
View Replies !
View Related
[F8] Add Rotation To Dynamic Movieclips
I'm trying to create draggable, duplicate movieclips that can also be rotated. I have worked out the duplicating and the swapDepths. But, I can't seem to get the rotation to work. The selected object should rotate when the rotate button is clicked. There are currently three interactive items on the stage. Two of them can drag and swap depths. The other one can drag and can be rotated. I'm trying to get the other two to be able to rotate like the third. The difference is that the 2 are mc's and the third is a button. Check out the attached file.
peace
View Replies !
View Related
Unloading Dynamic Movieclips, Please Help
Ok I'll try and keep this simple I have a movieclip which randomly duplicates itself somewhere on the x value between 1 and 396, above the stage it then decends downwards using a separate movieclip that I have set up which runs though a series of frames moving the moviclip down 2px every frame, When it reaches the bottom of the screen I have a hit area covering the bottom of the stage, when it hits this I would like it to unload.
Ive tryed so many different things but I can't seem to get it to work.
THANKS!!! ?
View Replies !
View Related
Getting Index Of Dynamic Movieclips
I've made a bunch of MovieClips that are loaded dynamically and then loaded into a ScrollPane. I'm able to setup MouseEvents on each MovieClip as they are being made, but I'm not sure how to go from there. Right now I just get "instance79" or whatever when I trace my clicks. I'd like to be able to return a name or index or the name of the jpg that was originally loaded. As each clip is added they are also pushed into an Array if that helps.
View Replies !
View Related
|