Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Assigning A Linkage ID To A Movieclip Created With CreateEmptyMovieClip()



Hi,

I have a movieclip I created usind createEmptyMovieClip(). How can I assign a Linkage Id to that clip?

My reason for this is I later want to attach that clip I created to another clip using attachMovie() which requires a Linkage Id.

Thanks



ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0
Posted on: 01-25-2009, 11:43 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Resizing Movieclip Created By CreateEmptyMovieClip
i need help in resizing a movieclip created with createEmptyMovieclip.I tried changing the property using setproperty,the result : no image shown at all..
i think i stting a property for a wrong movieclip..am I??please help me...



Code:
addressVars= new LoadVars();
addressVars.load("http://localhost/test/flashmx_dbPassReturn.php");
addressVars.onLoad = function() {
for (i=0; i<this.n; i++){
myMC = createEmptyMovieClip("holder"+i, i);
myContainer = myMC.createEmptyMovieClip("container", 1);
myContainer.loadMovie(this["picFile"+i]);
setProperty("myMC", _width, "35"); //i want to change the clip size so that
setProperty("myMC", _height, "35"); //it'll appear as thumbnails
myMC._x = (40*i);
myMC._y = (1*i);
pic = new Array();
myMC.pic = (this["picFile"+i]);
myMC.i = i;
myMC.picfile = this["picFile"];
myMC.onPress = function (){
_root.screen.loadMovie(this.pic);
}
}
}

Assigning Movieclip To Dynamically Created Movieclip
In part of my actionscript i'm using:

thumbnail_mc.createEmptyMovieClip("t"+k, thumbnail_mc.getNextHighestDepth());

to create a seperate movieclips for ewach image in my xml file.

How would I then attach another movieclip to each of the newly created ones?

ie thumbnail_mc.t0, thumbnail_mc.t1, thumbnail_mc.t2...

is there a way to do it automaticall7y or do i have to assign it to each one individually?



"thumbnail_mc.t"+k.attachMovie obviously doesn't work

Assigning Movieclip To Dynamically Created Movieclip
In part of my actionscript i'm using:

thumbnail_mc.createEmptyMovieClip("t"+k, thumbnail_mc.getNextHighestDepth());

to create a seperate movieclips for ewach image in my xml file.

How would I then attach another movieclip to each of the newly created ones?

ie thumbnail_mc.t0, thumbnail_mc.t1, thumbnail_mc.t2...

is there a way to do it automaticall7y or do i have to assign it to each one individually?



"thumbnail_mc.t"+k.attachMovie obviously doesn't work

Can A Created "createEmptyMovieClip" Movieclip Have A RollOver State?
.... because I can't get it to work!

Code:
var thumbBalcony:MovieClip = this.createEmptyMovieClip("thumbBalcony",this.getNextHighestDepth()+3);
thumbBalcony.loadMovie("flash-balcony-small.png");

thumbBalcony.onRollOver = function():Void {
thumbNoteOut("thumbBalconyText");
}
Is this supposed to be like this? Orrr am I missing something?

Masking A Movieclip Created Using "CreateEmptyMovieClip"
I want to load .jpg files and as I want to trap .jpg files height and width I have used "CreateEmptyMovieClip" option. But the problem begin when I tried to mask the jpg image.

Please let me know how can I mask it.

Here is the code that I am using
===============================

this.createEmptyMovieClip("holderMC",1);
holderMC._x = 100;
holderMC._y = 100;
holderMC.loadMovie("http://www.xponsedev.com/mockups/landnodown/mock1.jpg");
this.onEnterFrame = function() {
percent = (holderMC.getBytesLoaded()/holderMC.getBytesTotal())*100;
if (percent == 100) {
a = holderMC._height;
delete this.onEnterFrame;
}
};

Assigning As To CreateEmptyMovieClip() Movie
Is there a way to assign actionscript to an empty movieclip created with the createEmptyMovieClip() method?

Assigning A Class W/ CreateEmptyMovieClip
Hi, I understand how to tell Flash that a preexisting symbol in the library should belong to a certain custom class, but how do you do this when creating movie clips w/ createEmptyMovieClip?? thanks in advance...

Assigning Linkage After AttachMovie?
I'm trying to attach a movie and understand that when you attach a movie the file that attaches has a new instance name. But the attached movie does not respond to my drag code. Is there a way to code to assign the attached movie a linkage ID that will allow it to respond to my drag code?

Assigning Linkage ID's With Actionscript
Anyone know how to load an image AND assign a linkage identifier name to it with Actionscript (rather than importing an image to the library, opening the info dialog box and assigning a linkage identifier name)?????

How Do I Close A MC Created With CreateEmptyMovieClip?
I have a series of objects each dynamically created with createEmptyMovieClip. They are contained within a parent movie clip.

Sometimes there can be many of these clips. Each is on a different level. So far, I have found no means of deleting or otherwise getting rid of them after they are no longer needed.

I have tried getting rid of the parent clip, but the child clips stay. Does anyone know how I can delete these unwanted MCs?

Thanks,

Will

Code On MC's Created With CreateEmptyMovieClip
Is there any way to put code on an mc created with createEmptyMovieClip?

OnClipEvent For Clips Created With CreateEmptyMovieClip
Is there a way of using onClipEvent(data) when I use "createEmptyMovieClip" to create a clip which will be loaded with data from an external source?

if i try the following on frame 1 (action layer):

_root.createEmptyMovieClip("TempVars", 1);
loadVariables("dbquery.php","TempVars");
_root.TempVars.onClipEvent(data){
_BabyClip._alpha=25;
}

I get the following message in Output...
Scene=main, Layer=Layer 1, Frame=1: Line 3: Expected a field name after '.' operator.
_root.TempVars.onClipEvent(data){

any ideas?
thanks

Daf

Remove Clip Created With CreateEmptyMOvieClip
I was wondering is there any way to remove a mc created with CreateEmptyMOvieClip ???

Any1 know any wayaround ?

Destry Movie Created With 'CreateEmptyMovieClip'
I have been reading the documentation, and i cannot find a way to remove clips that are created using this method. Like the guy in the other post, i want this clip unloaded (destroyed) when ANY other link is clicked. This clip is an empty container clip that will be generating child clips that will each be loading thumbnails for images. Obviously i need to destroy the parent clip to remove all children without looping, etc.

This movie clip ("TL") is created in a keyframe that is the stopping point of an animation. When a user clicks the Portfolio link from the menu, the menu hides itself, and then goes to a frame label where actionscript awaits. Once there, the AS tells the submenu movie to animate (play). The submenu then plays and stops when it hits a certain frame (the one with the 'stop();' code, lol), and that frame then contains actionscript that generates the Gallery Thumbnails' parent container ("TL"), via:
var TL:MovieClip = createMovieClip("TL",60);

and GT then creates movie clips for thumbnails to be contained in via:
TL.createEmptyMovieClip('Thumb' + i,TL.getDepth() -1);

All this works so far. Now, to get rid of the clip when any other button is clicked, i tell the gallery movie to play again, which alphas it out of sight. So, on the NEXT frame of the timeline AFTER the frame which the TL and children are created is where i need to place the actionscript to unload/remove them. The problem is that there is no method for this! It seems that all the methods for removing / unloading clips only apply to clips that were duplicated or instatiated from loading external files or attaching instances from the library...

So that's where i'm stuck. I need to remove this "TL" clip, and can't figure out how. Any help is apreciated. The site is http://UniSys-Corp.com if it would help to see how my menus animate.

I tried switching things around a bit, to no avail. This works:

PHP Code:



    _root.mcMenuGalleryAnimation.attachMovie("thumbsList","TL",60);

    TL._x = -300;

    TL._y = 0;

    TL.width = 60;

    TL.height = 60;

    TL.loadMovie("../portfolio/misc/tn/1.jpg");




But this does not:

PHP Code:



    _root.mcMenuGalleryAnimation.attachMovie("thumbsList","TL",60);

    TL._x = -300;

    TL._y = 0;

    TL.width = 60;

    TL.height = 60;

    TL.attachMovie("thumbnail","tn",TL.getDepth() +1);

    tn.loadMovie("../portfolio/misc/tn/1.jpg");

When Killing A Container Created By CreateEmptyMovieClip
howdy all --
say i have a container created by createEmptyMovieClip and it contains six items created via attachMovie... If i do a container.unloadMovie(); will that unload/do away with all the movies within it as well? .. (and is removeMovieClip somehow a better option?)

Many thankS!

RemoveMovieClip On Object Created From CreateEmptyMovieCLip
From the flash help, it says:

Method; removes a movie clip instance created with the duplicateMovieclip action, or the duplicateMovieClip or attachMovie methods of the MovieClip object.

But i have movieClips created from createEmptyMovieClip();, so i'm assuming removeMovieClip(); won't work. Is there another way to remove this then?? thanks!

?onPress Event With MCs Which Were Created With CreateEmptyMovieClip?
how can I have the onPress and all the other event handlers working
with MCs wich were crated with the createEmptyMovieClip?
I allready did some reading wich says that I have to assign them to a
external class file, but so far I have no idea how to do that and what the
.AS file should contain.

Destry Movie Created With 'CreateEmptyMovieClip'
I have been reading the documentation, and i cannot find a way to remove clips that are created using this method. Like the guy in the other post, i want this clip unloaded (destroyed) when ANY other link is clicked. This clip is an empty container clip that will be generating child clips that will each be loading thumbnails for images. Obviously i need to destroy the parent clip to remove all children without looping, etc.

This movie clip ("TL") is created in a keyframe that is the stopping point of an animation. When a user clicks the Portfolio link from the menu, the menu hides itself, and then goes to a frame label where actionscript awaits. Once there, the AS tells the submenu movie to animate (play). The submenu then plays and stops when it hits a certain frame (the one with the 'stop();' code, lol), and that frame then contains actionscript that generates the Gallery Thumbnails' parent container ("TL"), via:
var TL:MovieClip = createMovieClip("TL",60);

and GT then creates movie clips for thumbnails to be contained in via:
TL.createEmptyMovieClip('Thumb' + i,TL.getDepth() -1);

All this works so far. Now, to get rid of the clip when any other button is clicked, i tell the gallery movie to play again, which alphas it out of sight. So, on the NEXT frame of the timeline AFTER the frame which the TL and children are created is where i need to place the actionscript to unload/remove them. The problem is that there is no method for this! It seems that all the methods for removing / unloading clips only apply to clips that were duplicated or instatiated from loading external files or attaching instances from the library...

So that's where i'm stuck. I need to remove this "TL" clip, and can't figure out how. Any help is apreciated. The site is http://UniSys-Corp.com if it would help to see how my menus animate.

I tried switching things around a bit, to no avail. This works:

Code:
_root.mcMenuGalleryAnimation.attachMovie("thumbsList","TL",60);

TL._x = -300;

TL._y = 0;

TL.width = 60;

TL.height = 60;

TL.loadMovie("../portfolio/misc/tn/1.jpg");
But this does not:

Code:
_root.mcMenuGalleryAnimation.attachMovie("thumbsList","TL",60);

TL._x = -300;

TL._y = 0;

TL.width = 60;

TL.height = 60;

TL.attachMovie("thumbnail","tn",TL.getDepth() +1);

tn.loadMovie("../portfolio/misc/tn/1.jpg");

RemoveMovieClip On Object Created From CreateEmptyMovieCLip
From the flash help, it says:

Method; removes a movie clip instance created with the duplicateMovieclip action, or the duplicateMovieClip or attachMovie methods of the MovieClip object.

But i have movieClips created from createEmptyMovieClip();, so i'm assuming removeMovieClip(); won't work. Is there another way to remove this then?? thanks!

Deleting Movieclips Created With CreateEmptyMovieClip()
in the flash documentation it says you can use 'RemoveMovieClip()' to delete movieclips created with 'duplicateMovieclip()' and 'unloadMovieclip()' to delete movieclips created with 'loadMovie()' but what about a clip created with 'createEmptyMovieClip()'?

how can I delete this clip?

in context:
I'm creating an application that requires the drawing of various polygons over the top of images...
creating a polygon creates a new empty MovieClip which is then has the polygon drawn in it.
when you finish plotting a polygon it gets assigned onPress events...(so i can select it)
now I wish to be able to select the polygon and press 'del' and it'll delete it.

sure I could just set it invisible but surely there's a way to kill a movieclip after you create it?

Remove A Clip Created With CreateEmptyMovieClip
Hi All

I'm trying to remove a created movie clip, but it's not working.
Does anyone know why this isn't working?

MovieClip.prototype.scaleUp = function (scaleAmount, scaleSpeed,callBackFunction)
{

var depth = this.nextDepth ();
this.createEmptyMovieClip ("scaler_mc", depth);
var mc = this.scaler_mc;
mc.scaleAmount = scaleAmount;
mc.scaleSpeed = scaleSpeed;
mc.onEnterFrame = function ()
{

if (this._parent._xscale < this.scaleAmount)
{
this._parent._xscale *= this.scaleSpeed;
}
else if (this._parent._xscale <> this.scaleAmount)
{
this._parent._xscale = this.scaleAmount;


this._parent[callBackFunction]();
// this bit is not working
this._parent.removeMovieClip(this)
//also like this removeMovieClip(this)
// and this this.removeMovieClip();
// and this this._parent.removeMovieClip(this._parent.scaler_mc)


}
};
};
it wont get rid of the created clip but if i try this:
this.createEmptyMovieClip ("scaler_mc", 1);
removeMovieClip(scaler_mc);

gets rid of it straight away.

Regards

Dan

Deleting Movie Clip Created By CreateEmptyMovieClip
how can I delete/remove/whipe-out/DESTROY a movie clip created by createEmptyMovieClip();?
I tried to use removeMovieClip...but obviously it doesn't work.

Can't Remove Movie Created With _root.createEmptyMovieClip(}
I have a portion of code listed below that is used to create a movie clip called "Menu". It loads a movie array called itemClip. All works fine. My problem is I can't figure out how to unload the menu movie. I have tried several options, including menu.removeMovieClip(); ... to no avail. Can anyone tell me how to remove the clip from the current timeline?



Code:
var menu = _root.createEmptyMovieClip("menu_mc", 1);
menu._x = 250;
menu._y = 50;


for(var i=0; i < sectionCount; i++){
var depthCount = menu.getNextHighestDepth();
var item = menu.attachMovie("itemClip", "item_" + i, depthCount);
item.labelName = titles[i];
item.song = songs[i];
item.targetClip = this;
item._y = i*25;
Any help would be appreciated.

Thanks
Rick

Problem With Deleting A Mc (created With CreateEmptyMovieClip) 18+ Site
Hello,

I've used the 'photodrop' gallery which you can find on braingiants.com. This is a xml-based gallery with some animation on the photo's.
I've implemented this script in my home.fla on a certain frame. On that frame, there are several movieclips created to load the thumbnails and the pictures. All this works fine.
Now here comes the clue: when I click a button to go to another frame, the thumbs and the big picture stay on the screen (although the '+' and '-' button next to the thumbs dissapears).
On every page, there is an external swf loaded into the mc 'holder'. I've tried to load the gallery.swf into 'holder', but it didn't work anymore. That's why I've pasted the script into the home.fla.

To show you the problem: click here and then on 'portfolio' on the bottom. You'll see that it works fine. When you click another button, the picture and thumbnails stay on the screen...

How can I fix this? I've been looking for 2 days now and tried all sorts of things with removeMovieClip, unloadMovieClip,.... and SwapDepths, but I can't seem to figure it out.

You can download the fla here and the xml-file is here.

All help is appreciated!

Adding Actions To MCs Created Using CreateEmptyMovieClip Doesn't Work - Pls Help
Hi all

I'm wondering something. I checked the help section for createEmptyMovieClip and there I found this code:


Code:
this.createEmptyMovieClip("logo_mc", this.getNextHighestDepth());
logo_mc.loadMovie("http://www.macromedia.com/images/shared/product_boxes/80x92/studio_flashpro.jpg");



If I just paste this in a new document it works fine. But I want to add a onRelease action to this new MC, but that doesn't work, so my question is:
Is it even possible to add actions to MCs created with createEmptyMovieClip?

Here's the code I tried:


Code:
this.createEmptyMovieClip("logo_mc", this.getNextHighestDepth());
logo_mc.loadMovie("http://www.macromedia.com/images/shared/product_boxes/80x92/studio_flashpro.jpg");

logo_mc.onRelease = function() {
getURL("http://www.flashkit.com", "_blank");
}

[MX] Dynamically Naming Clips Created With _root.createEmptyMovieClip()
Hi

Simple question – how can you name clips “dynamically” when using using _root.createEmptyMovieClip() ?

I have an incrementing variable “r” that I am using in the following scenarios, but nothing gives?

_root.createEmptyMovieClip("curveline"+ r, (1000+r));

_root.createEmptyMovieClip(this[curveline”+ r], (1000+r));

_root.createEmptyMovieClip(_root[curveline”+ r], (1000+r));

The code works fine with just "curveline"in the parameter field, but as soon as I append “r” to it, to eanble me to address it later, the function fails?

Flash MX Actionscript (targeting Movieclips Created Useing Createemptymovieclip()
Hey all


I am having a tough time figuring out this code that I am writing and am wondering if anyone can lend a helping hand.

I am making a flash movie for my webpage that displays my photographs taking.

www.cpasols.com/photos2.htm

The movie loads the jpg files in dynamically with the createEmptyMovieClip() in a movieclip named imageHolder

I then load imageHolder into the scrollBar component.

From the scroll bar component I can scroll the movieclip imageHolder.

I run a trace on the jpg so that When i press the jpg that is loaded in imageHolder, the path name of the jpg comes up.

The issue that I am having is that when I press any image, the path name comes up as imageHolder instead of imageHolder.jpg5(or jpg 6, really depending on what jpg the image is)

Everything works as it should except targeting the jpg images.

Here is all of the code that I have written so far( there are 3 movie clips in this movie)

code in Frame 1 on the Root of movie

for (i=0; i<7; i++) {
name = "jpg"+i;
_root.imageHolder.createEmptyMovieClip(name,i);
trace(_root.imageHolder[name] );
mc = _root.imageHolder[name];
mc._xscale = 30;
mc._yscale = 30;
mc._x = 0;
mc._y = (130*i);
trace(_root.imageHolder[name]._name);
//Change the blue to absolute web address of your images
mc.loadMovie(("C:\Business\Carlos Site\photopage\images\")+[name]+".jpg",_root.imageHolder, i);
}





code in MovieClip 1(imageHolder)
on (rollOver)
{
_root.bigImageHodler.loadMovie(("C:\Business\Car los Site\photopage\images\")+[_root.name]+".jpg", i +1);
trace(_root.imageHolder + "."+ _root.name);

//trace(_root.imageHolder[name]._name);
//loadMovie(("C:\Business\Carlos Site\photopage\images\")+[name]+".jpg", 0);
//trace(_root.imageHolder._name+_root.name);



}


code in scroll bar component (scrollBox)

onClipEvent (enterFrame) {
_root.scrollBox.setScrollContent(_root.imageHolder );
}



there is no code in the last movieclip (bigImageHolder)

I have ran the debugger on this code and it creates the movie clips and i can see the jpgs, i just cant target them.



Thanks for any help at all.
I know the paths are how they are on my local pc.
I have attacfed the fla file that I am working on also

Problems Assigning Properties To An MC I Created To Draw In
Hi, this is what i'm trying:

Creating a function that draws a rectangle with the given values. I use the drawing API for this. Then I want to change the properties of the MC i created to draw in. This is where the problems rise.
I give the code first:

Drawbar = function (nm, Lbwidth, Lbheight, Lbx, Lby, Lbdepth) {
_root.createEmptyMovieClip(nm, Lbdepth);
with(nm) {
lineStyle(0,0xCCCCCC);
beginFill(0x000000, 0);
moveTo(Lbx, Lby);
lineTo(Lbx+Lbwidth, Lby);
lineTo(Lbx+Lbwidth, Lby+Lbheight);
lineTo(Lbx, Lby+Lbheight);
lineTo(Lbx, Lby);
endFill;
}

};

Drawbar("bar1", 300, 20, 0, 0, 1);
bar1._xscale = 500;


As you can see i create an MC called bar1, the following line changes the _xscale propertie to 500, this works as I can see in the debugger, where the _xscale value of bar1 is 500. But the MC doesn't resize?! Even if I change the properties of bar1 manually using the debugger, it has no effect on the stage.

So where did I go wrong? What have I forgotten?

Assigning Variables To Dynamically Created Buttons
Hi

i have made a button in flash mx and give it instance name pics now on the first frame i have put the following code.

i = 0;
while (++i<=5) {
xpos = i*40;
duplicateMovieClip("pics", "nextpic"+i, i);
newName = eval("nextpic"+i);
setProperty(newName, _x, getProperty("newName", _x)+xpos);
}

It duplicates the button 5 times e.i. now i have five buttons on the stage.

My Question is how can i assign some variable on clicking the buttons
(for ex. i want to assign a=1 on but1, a=2 on but2, a=3 on but3....etc.)

Anybody knows how to deal with it.

PLS HELP Assigning Loadmovie() To Dynamically Created Buttons
ok... after taking a long break from this file...(been swamped with work recently)...I tried a crack at it again. I can't seem to figure out how to assign onRelease actions to the buttons to make them load external swf files. Now as it turns out... i need to get this working ASAP.

checking out the attached file is probably a good idea to understand what i'm alking about here.
i tried adding this (in red) to where the buttons are set up initially:
code: ymenu_mc.addItem("01 ", {text:" Feature Sheets", data:"item0.swf"});
i did that thinking if i added a statement like this (also in red) to the button/mc actions it would load the movie i defined in data: into and empty mc named test :
code: bg_mc.onRollOver = function() {
_parent.selectItem(id);
};
bg_mc.onRollOut = bg_mc.onReleaseOutside = function() {
_parent.deselectItem(id);
};
bg_mc.onPress = function() {
_parent.clickItem(id);
};

bg_mc.onRelease = function() {
trace(this.ymenu_mc.data)
this.test.loadMovie(this.ymenu_mc.data);
};
// instead of this.ymenu_mc.data i also tried using
// _parent.items_arr[newId].mc.data in place of ymenu_mc.data and a few other similar variations
//each time trace() returns "undefined" as the value

Assigning Variables To Dynamically Created Movieclips
I'm building a navigation menu using dynamically duplicated movieclips. When the user clicks on a menu item, a submenu appears, and the menu items move down to accomodate the submenu.

I found a tutorial on line that was designed for Flash MX, with actionscript 1, and I've rewritten almost everything to work in AS2. BUT--

I'm having a problem figuring out how to assign a numerical index to each dynamically created menu item.
The code that I have now is causing a problem when I try to test the movie-- flash says "there is a problem with one of the scripts in this file, causing flash player to run slowly. Do you want to abort this script?"

The section of script that I'm having problems with is as follows:

//------------------<SHOW SUBMENUS>-------------------\

// called by clicking the main menu buttons, this shows the submenu and moves the main menu buttons to give them space

function submenuShow() {
resetMenu();
h = eval("subText" + choice);

if (h >= 1) {
for (n = 1; n <= h; ++n) {
this["subMenuMC" + choice + n]._visible = true;
}
this["menuMC" + (choice + 1)]._y = this["subMenuMC" + choice + (n-1)]._y + this["subMenuMC" + choice + (n-1)]._height;
for (p = choice + 2; p<=_root.total; ++p) {
this["menuMC" + p]._y = this["menuMC" + (p-1)]._y + this["menuMC" + (p-1)]._height;
}
}
}

//------------------</SHOW SUBMENUS>-------------------\

I think the variable "choice" is causing the problem. I'm calling this variable at the very beginning of the script, in this section of code:

for (i=1; i<= _root.total; ++i) {
//duplicate movie clip
menuMC.duplicateMovieClip("menuMC" + i, i);

//then position them one under the other

this["menuMC" + i]._y = this["menuMC" + (i-1)]._y + this["menuMC" + (i-1)]._height;
/*The next step is to assign a variable to each main menu
button, so that when it is clicked, there is a simple method for identifying
the menu item.
*/
this["menuMC" + i].choice = i;

/* Finally, track how many levels have been used to create the main menu, so that
these can be added to as the submenus are duplicated.
*/
levelTrack = i;
}

Basically, I need to be able to reference a number index for each item on the menu, so that I can plug it into the code that operates the submenu.

Am tearing my hair out over this one-- please help.

Assigning A Variable Value To A Dynamically Created Object Property
OK... here's a code snippet. I'm trying to take the value from a variable being loaded from a text file which could be named utFormat1_font, or utFormat2_font, utFormat3_font, etc...

untfFont = ("utFormat"+i+"_font");
eval ("utFormat"+i+".font") = untfFont;

I think the problem here is the part that states:
eval ("utFormat"+i+".font")

How can I dynamically assign the value of untfFont to utFormat1.font, or utFormat2.font, etc...

The reason I'm doing this this way is because I have no idea how many iterations this loop will have to execute at this time. It needs to be able to dynamically expand to accomedate 30, 300 or 1 utFormat??.font values.

CAN ANYONE HELP??????

Assigning Mouse Actions To Dynamically-created MovieClips
Here's what I'm starting with:

Code:
_root.createEmptyMovieClip("jpegbutton",0);
jpegbutton.loadMovie("http://www.test.com/jpeg.jpg");
I want to be able to use that movie clip as a button, with MouseDown, MouseUp, etc. actions. How do I do it?

Thanks in advance!

Assigning Button Functions To Dynamically Created Buttons
Hi all,
Heres ther scenario - im building an xml navigation movie for our site. The xml is read in, and loops through xml creating the top level buttons (there's 7 in total). Within that loop is another loop which creates the subnavigation options.

Because the navigation is hoziontal and the button lengths vary greatly, the brief is to do everything on the fly - there's nothing other than the backgrounds and the fonts in the library.

So for example, the first xml node is 'About', the script makes the 'About' button, positions it on screen, then loops through & creates the sub nav buttons. All good so far. Once the sub nav is complete, I want to assign the top level button an action to show/hide the subnav (it calls a prototype):

//newClip is the top level button
newClip.onRollOver = function ()
{
subClip.moveThisY (22, 3);
};
newClip.onRollOut = function ()
{
subClip.moveThisY (-19,15);
};

This works to a point, but all the buttons show/hide the same subnavigation (the last one created) not their own. i.e. if the first button is 'About' and the last is 'Products', the 'About' button shows & hides 'Products' sub nav. any ideas where im going wrong? i'm guessing i need someway of evaluatig/assigning a value to the Rollover function.

Cheers for ya help peeps.

James

Assigning Variables To Text Fields In Dynamically Created Mc's
Hi Guys n Gals,

Here's a teaser that I'd like some help with:

for (i=0; i<aLetters.length; i++) {
trace('aLetters = '+aLetters[i]);
attachMovie("spider", "spiderD"+i, _root.getNextHighestDepth());
spiderD[i].alphabet = aLetters[i];
}

aLetters is an array containing any word - say hello...

the trace works fine. The trace inside spiderD[i] works also so I know they're being created. However no instances of spiderD appear on the stage? Puzzling...

What I'm trying to do is set a text field variable inside the spider clip to each one of the letters in aLetters.

Can anyone help me? I'm not even sure I've explained it very well but its an interesting conundrum...

Cheers for any help

Problems Assigning SetRGB Method With Dynamically Created Number.
I was after a way to make a clip transition through a number of shades/colors by assigning a color objects “setRGB” method to a number which decreases every frame.

code: stop();
next_color=new Color("useit");
var num=22339033;
useit.onEnterFrame=function(){
num-=1;
next_color.setRGB(num);
trace(num);
}

Everything sought of starts off promising, but then the colors seem to get stuck in some kind of loop & revert back to the colour set at authoring before transitioning again.

Anyone any idea what is going on here or why it won’t work?

Fla attached

Problem Assigning Dynamic Event Handlers To Dynamically Created Clips
I am in a for loop creating clips and assigning a rollover script to each. It works if I hard code gallery_mc1.enterFrame = navGrow; I have pasted the relevant parts of the script below.

this["gallery_mc"+i].onRollOver = function() {
this["gallery_mc"+i].enterFrame = navGrow();
};
//////////////////////////////////////
navGrow = function () {
if (this._xscale<100) {
trace("it triggered navGrow");
this._yscale = this._xscale += 5;
this._y -= 5;
this._x -= 5;
} else {
this.onEnterFrame = null;
}
};

[F8] Assigning A Movieclip To An Attached Movieclip Dilemma
I attached a movie clip:
customer = _root.attachMovie("customer","customer"+number,_root.getNextHighestDepth());

I want to attach another clip that is unique for each customer being attached by:
customer.timer = _root.attachMovie("ticker","ticker"+number,_root.getNextHighestDepth());

Will the timer be attached and identified for each UNIQUE customer?

New MovieClip() Vs CreateEmptyMovieClip()
Anyone know why this is not working .. if you use the new MovieClip() to instance a movieclip none of the movieclip-methods are available -- BUT when you attach/create ,and thus, psysically make a movieclip they are .. so what does new MovieClip do .. or Am I missing soemthing ..

this doesn't work :

myImageHolder = new MovieClip();
myImageHolder.onEnterFrame = function() {trace("test")}

and this is:

myImageHolder = createEmptyMovieClip("container",1);
myImageHolder.onEnterFrame = function() {trace("test")}

thnx in advange ..

Nyls

MovieClip.createEmptyMovieClip
Hi,
Is this function is new in Flash MX or was it already there in Flash 5?

Does the Function MovieClip.createEmptyMovieClip runs well on Flash5 plugin?

What's better performancewise (and other view):
having an empty MC in the stage and on load MC i'll load it into the empty MC (the location is already determinded)

OR

use the function: MovieClip.createEmptyMovieClip and 2 lines of code to place it where ever i want it to be?

I'm using alot the loadMovie into an empty MC so i need to know what's better,
Thanks in advance,
Maya.

How To Hide My Current Movieclip And Display 2nd Dynamically Created Movieclip?
I have a movieclip in which there is an image create this movieclip dynamically by reading the oath of the image from file and play an effect. its working fine, now i want to hide this MC after its effect is ended and then dynamically want to create the other MC and similarly so on. how to do that. my code is as below:

var mcLoader:MovieClipLoader = new MovieClipLoader();
mcLoader.addListener(this);

lv.load("data.txt");
var my_lv:LoadVars = new LoadVars();
my_lv.load("data.txt");
my_lv.onLoad = function(success)
{
if (success)
{
if(this.pic1!=undefined)
{
var ImgMc:MovieClip = createEmptyMovieClip("ImgMc", getNextHighestDepth());
_root.mcLoader.loadClip(this.pic1,_root.ImgMc);
//Some effect on ImgMc

//how to hide the ImgMc whe nits effect is played and then load another image in a movieclip and so on
}
}
}

How To Load Image Into Movieclip Inside Movieclip That Is Dynamically Created?
Hello Kirupa Cats!

I am building a menu from an XML file, and I'm cool with cyclying thru the xml data to create menu items.

For every menu item in my XML file, I'm using attachMovie to insert a movie clip called menuitem from my library into a movieclip called menuholder. This works no problem, my menuholder movieclip is poplulated with as many menuitem movieclips from the library as designated by the xml data.

However, inside the library movieclip called menuitem, I have another movieclip on its stage, called mc_menuImage. I want to load an image into that movieclip, and I'm taking the URL for the image from the XML data.

My problem is I can't seem to figure out how to fully identify the movieclip mc_menuImage to load the image. It may have something to do with the fact that the library movieclip is being loaded dynamically, but the movieclip inside the library movieclip exisits pysically on the stage. I don't know...here's the code I'm working with:

THE CODE:

var xmlMenu:String = "menu.xml";
menuholder = createEmptyMovieClip("menuholder", -1);

var xmlMenuData:XML = new XML();
xmlMenuData.ignoreWhite = true;
xmlMenuData.load( xmlMenu );
xmlMenuData.onLoad = function(loaded) {
if (loaded) {
var mImage:Array = new Array();
var mRootNode = this.firstChild.childNodes;
totalMenuItems = mRootNode.length;

// fill array
for (var i = 0; i<totalMenuItems; i++) {
mImage.push(mRootNode[i].attributes.menuImage);
}
}

//make the menu
for (var i = 0; i<totalMenuItems; i++) {
var menuitem = menuholder.attachMovie("menuitem", "menu"+i, i);
menuitem.id = i;

/* now here I thought I could just do this: */
menuitem.mc_menuImage.loadMovie(mImage[i]);
/* but that doesn't work... */

};


When I trace menuitem I get this: _level0.menuholder.menu0, _level0.menuholder.menu1, etc, so I figured the syntax menuitem.mc_menuImage would identify the movieclip inside menuitem, but to no avail. Maybe it has something to do with levels, I'm not sure...

So I don't know, any suggestions? Thanks so much!!!

Assigning Text In Dynamically Created Text Fields; Flash 8
I'm having trouble with dynamically assigning text to a dynamically created text field.

This works:
ActionScript Code:
//set font with TextFormat
myFormat=new TextFormat();
myFormat.align="left";
myFormat.color="0xFF3300";
myFormat.font="MyriadProBoldCon";
myFormat.size=25;

//create text field
this.createTextField("timText", 1, 10, 10, Stage.width,40);
timText.text="I declare a truce for robot juice";
timText.embedFonts=true;
timText.setTextFormat(myFormat);




but this doesn't:
ActionScript Code:
//set font with TextFormat
myFormat = new TextFormat();
myFormat.align = "center";
myFormat.color = "0xFF3300";
myFormat.font = "MyriadProBoldCon";
myFormat.size = 25;
//create text field; text shows up right now
this.createTextField("timText", 1, 0, 10, Stage.width, 40);
timText.text = "I declare a truce for robot juice.";
timText.embedFonts = true;
timText.setTextFormat(myFormat);
//but click a button, and the text disappears and is not replaced!!!
btn1.onRelease = function() {
timText.text="Breakfast is served all day in Hell!"
};
btn2.onRelease = function() {
timText.text="We prefer to be called Buccaneer-Americans."
};
btn3.onRelease = function() {
timText.text="It's fun to use learning for evil!"
};




I've tried setting up the TextFormat and createTextField as a function that's called on the onRelease handler. I've tried dropping the whole frackin' code in the onRelease function for each button. Neither approach works.

I've been digging around on the web, looking for answers, and nothing seems to solve my problem. Does anyone have any ideas?

thanks in advance!

MovieClip.onLoad And CreateEmptyMovieClip
I am trying to use createEmptyMovieClip, and assign each new empty MC an onLoad function, to initialize the location, etc, but the onLoad function never executes.

_root.createEmptyMovieClip("box", "box" + boxNum, boxNum);
_root["box"+boxNum].onLoad = function (){
trace("onLoad Called");
}
_root["box"+boxNum].onEnterFrame = function (){
trace("onEnterFrame called");
}


the onEnterFrame is called, but the onLoad is not called...
Any suggestions?

Also, one more quick question, what command makes the movie unscalable, like when internet explorer, if you right click on the file, you can' zoom in on the file?
I tried fscommand("allowscale", "false"); but it doesn't seem to work...

Thanks,

Dave

Assigning Varibles From One MovieClip To Another MovieClip
if for instance i had two movieClips and in one depending on which frame the movie was on it assigns a varible to match, ie frame 1 ---> varible=1

then how could i create a varible in another movieClip, or reference the first varible, which checks this varible and progreeses as required.

Sean

MOVIECLIP PROBLEMS: Referencing CreateEmptyMovieClip
guys,
I've got one little.. yet anoying problem here and I don't know how to get rid of it

I'm reading in an XML file that has the location of images. I've got a movieclip on stage that acts as a container (mc_container is it's name).

What I want is for each image that is read in, to be inside a new MC so that I can movie it around or change opacities later on.
- ie use createEmptyMovieClip and mc.loadMovie(image.jpg)


It's all in a loop and it looks like this:
code: ...
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
_root.mc_2D_img.createEmptyMovieClip("img"+i, _root.mc_2D_img.getNextHighestDepth());
_root.mc_2D_img.("img" +i).loadMovie(image[i]);
//trace(image[i]);
}

This obviously doesn't work - else I wouldn't be posting here. The reason is for the part that goes:

code: _root.mc_2D_img.("img"+i).loadMovie(image[i]);

Now I don't know how to properly reference the newly created MC without it causing grevious errors or simply doing nothing.

There must be a way to reference the new movieclip labeled img1, img2 etc etc.

Can anyone shed some light?

Problems With Release(movieClip) And CreateEmptyMovieClip
Hi, I've created a function to load some photos from an XML document in a movieclip (instance name: contenedor), with createEmptyMovieClip and it works fine. But now, I'd like the "created movieclips" containing the photos become buttons. I try with on Release(movieClip) function, but I have a problem: only the last loaded photo work as a button, for example if I load 4 photos the 4th works fine, but the rest doesn't work. Here is the code of my function:

Regards, Xatucans.










Attach Code

function photoLoad(){
_root.total=this.firstChild.childNodes.length //total photos in XML archive
for (i=0; i<=_root.total-1; i++) {
photoLoaded=this.firstChild.childNodes[i].attributes.pics;
myPhoto=_root.contenedor.createEmptyMovieClip("mc"+i, i)
posi1=getProperty(_root.contenedor["mc"+(i-1)], _x);
setProperty(myPhoto, _x, posi1+145);

myMCL = new MovieClipLoader();
myMCL.loadClip(photoLoaded,myPhoto);
myMCL.onLoadInit = function (){
myPhoto.onRelease = function() {
this._alpha = 20;
}
}
}
};

MovieClip.onPress Only Executes CreateEmptyMovieClip Once?
Now, this is really strange... Is there a difference between onPress behaviour of a Button Symbol and a MovieClip?

I wrote this function, which was becoming to be the host of a loop, which would dynamically add items to my submenu, but, a very strange thing happened. menubutton1 is a movieclip, if i leave it this way, my object "submenu1" will be removed, when i invoke the creation of a second emptyMovieClip (the trace before the second "createEmptyMovieClip" would give me the coordinate and the trace after the "createEmptyMovieClip" returns "undefined" ) --> but if i make menubutton1 a button, it works perfectly fine, now my problem is that menubutton1-n are created dynamically in actionscript and therefor are MovieClips and MovieClips only (except if there may be a trick, to create an alpha=0 Button on the fly, which i could lay over my actual MovieClip Button - But I doubt that)

well here's the code:



function loadentries(num, submenu_height, submenu_scrollstep)
{

eval("menubutton" + num).onRelease = function()
{

newmenubutton_name = "menubutton" + num;
submenu = "submenu" + num;

eval(newmenubutton_name)._x = menubutton_x;
eval(newmenubutton_name)._y = menubutton_y;

createEmptyMovieClip(submenu,this.getNextHighestDe pth());
eval(submenu)._x = eval(newmenubutton_name)._x;
eval(submenu)._y = eval(newmenubutton_name)._y;

count = 1;
// arrow up
newsubmenuitem = "submenuitem" + count;
eval(submenu).attachMovie("DropDown_SubMenuBG",new submenuitem,this.getNextHighestDepth());
eval(submenu)[newsubmenuitem]._width = eval(newmenubutton_name)[newmenubutton_name]._width-10;
eval(submenu)[newsubmenuitem]._height = submenu_height;
eval(submenu)[newsubmenuitem]._x = 5;
eval(submenu)[newsubmenuitem]._y += 7;

eval(submenu)[newsubmenuitem].createEmptyMovieClip("labelholder", this.getNextHighestDepth());
eval(submenu)[newsubmenuitem].labelholder.createTextField("arrowup", this.getNextHighestDepth(), 0, -2.5, 20, submenu_height);
myformat = new TextFormat();
myformat.size = "8";
myformat.font = "Arial";
eval(submenu)[newsubmenuitem].labelholder.arrowup.text = "back up again";
eval(submenu)[newsubmenuitem].labelholder.arrowup.setTextFormat(myformat);
count++;


trace(submenu1._y);
submenu = "submenu2";
createEmptyMovieClip(submenu,this.getNextHighestDe pth());
trace(submenu1._y);


switch(num)
{
case 1:
trace("entry1");
trace(submenu_height);

break;
case 2:
trace("entry2");
trace(submenu_height);
break;
}

}



}


if you want to test this code:
create at least one menu button (MovieClip), called menubutton1.
create a button, called tracer, to test if submenu1 is still there

then add this to the bottom of the code

loadentries(1, 50, 5);

tracer.onPress = function()
{
trace(submenu1._y);
}

AS Movieclip Linkage
hey guys, i'm a beginner in AS and have this assignment i'm kind od stuck with. there are 2 things i would like to ask here.

1. I have to import a certain ammount of jpg images into different movieclips.
do i just create a loop en than do a createEmptyMovieclip?
and how do i load the jpg files into that created Moviecilip?

2. when i would create these movieclips, i need linkage to use them in the rest of my script, but i don't know how to do this in AS. Normally i would just rightclick on an movieclip > choose linkage and check Export for Actionscript.
but how do is do it with movieclips created in AS?

Copyright © 2005-08 www.BigResource.com, All rights reserved