CreateEmptyMovieClip Woes
HiI've created an empty movie clip on the stage called 'photographs', to which I've attached a movie which I've given the instance name 'p1_mc'. This movieclip contains another with an instance name of 'p1_mc_base', which in turn contains a third with an instance name of 'close_btn'.I need to target 'close_btn' to call an onRelease function. I'm thinking the path would be:_root.photographs.p1_mc.p1_mc_base.close_btnwhich is borne out when I list the objects in the movie, but I can't get it to work. I've used getNextHighestDepth() with the createEmptyMovieClip and attachMovie functions.It's driving me nuts - can anybody help me out?Thanks
KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 10-19-2008, 04:12 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
CreateEmptyMovieClip Woes
Creating empty movie clips. Applying onEnterFrame functions to them. Previewing them shows the functions attached. Which is good.
Creating empty movie clips. Applying onEnterFrame functions to them. Loading JPGs into them. Previewing them shows the functions gone and the actions do not occur. Which is bad.
Any help?
CreateEmptyMovieClip Woes (poor Me)
okay, i'm beatin my head against the wall with this one.
basically i'm unable to load images into dynamic clips created using createEmptyMovieClip. In fact, now i'm starting to believe that the clips are not being created.
The first time my function runs, the clip is created and the pic loads in it fine. i use an .onEnterFrame function to check if it's (the pic) is loaded, and then i fade the alpha of that clip in.
a new clip fails to be created in subsequent calls to that function.
any help would be great! i commented out some stuff that has nothing to do with the problem...
code:
ActionScript Code:
_global.counter=1;
startSlides=function(){
/* j=p+1;
testClip["c"+j].fader.gotoAndPlay("unfade");
doppelganger=p+8;
testClip["c"+doppelganger].fader.gotoAndPlay("unfade");
doppelganger="";
fClip="c"+i;
trace("this is the fClip: "+fClip);
_global.arrayIndex=i-1;
trace("this is the arrayIndex: "+arrayIndex);
*/ this._parent.largePic.createEmptyMovieClip("clipp"+counter, counter);
//this._parent.largePic["clipp"+counter]._alpha=0;
trace("clipp"+counter);
this._parent.largePic["clipp"+counter].loadMovie("images/slider/large/"+pics[arrayIndex].attributes.file);
this._parent.largePic["clipp"+counter].onEnterFrame=function(){
trace("loading pic!!!");
var bytes_loaded = Math.round(this.getBytesLoaded());
var bytes_total = Math.round(this.getBytesTotal());
if (bytes_loaded != bytes_total && bytes_total>500) {
trace("still loading!");
} else {
trace("pic loaded!");
fClip=this;
var fadeIn:Tween = new Tween(fClip, "_alpha", None.easeNone, 0, 100, 1, "true");
fadeIn.onMotionFinished=function(){
delete this.onEnterFrame;
}
}
}
/*
n=i+1;
testClip["c"+n].fader.gotoAndPlay("fade");
doppelganger=i+8;
testClip["c"+doppelganger].fader.gotoAndPlay("fade");
doppelganger="";
*/
_global.p=i;
if(i==8){
i=1;
_global.counter++;
trace("function over and this is i: "+i);
trace("function over and this is counter: "+counter);
}else{
i++;
_global.counter++;
trace("function over and this is i2: "+i);
trace("function over and this is counter: "+counter);
}
}
Using CreateEmptyMovieClip()
I create an MC using creatEmptyMovieClip(), and within it I programmatically draw an object (called object) which is determined by user input and bunch of formulae.
I want the user to be able to scale the drawn object, because the range of values that can be input result in a drawn object that can be quite small or quite large.
I would like the rescaling to occur with a mouse drag, keeping the original aspect ratio. I've tried implementing a small script (given below) , which works fine on a different project, although this script does not maintain the aspect ratio.
This is what I've tried...
This script is placed on the first frame of an MC (called script), which sits on the main timeline....
//scale the object
var x = _root.object._x;
var y = _root.object._y;
var xf = parseInt((x*100)/446)-40;
var yf = parseInt((y*100)/239)-40;
if (xf < 0) {
xf = -xf;
} else if (xf < 2 && xf >= 0) {
xf = 2;
}
if (yf<0) {
yf = -yf;
} else if (yf < 2 && yf >= 0) {
yf = 2;
}
setProperty ("_root.object", _xscale, xf*5);
setProperty ("_root.object", _yscale, yf*5);
The MC 'script' is called from a button (on press, dragOut) which is only a hitstate, but it defines the area where the user can dragout the rescaling of the intended object.
This method doesn't seem to work because I do not know if I am targetting the MC 'object' correctly. The API says an MC created using createEmptyMovieClip() is a child of an existing movieclip - problem is I don't know which one and what the instance name is. When I trace the position of the MC 'object' it tells me: _level0.object
If someone has any ideas on how to get this scaling problem to work I would be most appreciative. (one other thing, how would I keep the aspect ratio during scaling)
Cheers
CreateEmptyMovieClip
does createEmptyMovieClip() function can be used only in the current frame or in any frame?
if it works only in the current frame is there a way to make it so it will be usablle in all frames?
thanks in advance
PEleg
CreateEmptyMovieClip Help
I have a dynamic hierarchial array menu in MX. The movie dimensions are 175x420.
I am trying to load it into a main movie (740x420) with this:
_root.createEmptyMovieClip("holder_mc", 0);
_root.holder_mc._x = 0;
_root.holder_mc._y = 0;
_root.holder_mc.loadMovie("menu.swf");
It loads in but when it does, the menu's x and y is all screwed up. I want it to just load in the left hand corner. Has anyone had this problem before?
CreateEmptyMovieClip
hey,
can you dynamically create an empty movie clip on a level, or does it have to be based on an exisiting movie clip?
i'm trying to fool with some stuff for sound, and i need to create a clip to hold my sound, and am just wondering if this can be done as opposed to creating one in the authoring tool.
thanks,
-myk
FYI: CreateEmptyMovieClip
I'm not sure if this has already been discussed here or if this appears in Moock's AS Definitive Guide book. Nonetheless, I discovered something recently that I feel is worth sharing.
The Flash MX docs for the createEmptyMovieClip function state that the function returns nothing. This is incorrect as I have discovered by experimentation. By actually assigning the return value of the createEmptyMovieClip function call to a variable, that variable becomes a reference to the newly created empty movie clip. Some of you might be thinking "so what?". Well, here's an example of where this might be of use:
<code>
var initialDepth = 100;
for (var i = 0; i < 10; i++)
{
var currentEmptyMC = createEmptyMovieClip("mc_" + i, initialDepth + i);
// Now you can reference the new empty movie clip as:
// currentEmptyMC.*;
// instead of:
// _root["mc_" + i].*;
}
</code>
In the above example, some of you may have learned the hard way that when you load a movie containing the above code into a parent movie, the _root["mc_" + i] would try to reference an element named "mc_".concat(i) in the parent movie's timeline, which would be undefined. That's another reason I always try to avoid _root now and use relative paths instead, e.g.: _parent.* or _parent._parent.* (similar to ../ and ../../ when it comes to file paths). That being said, this trick helps avoid the use of _root when dynamically creating empty movie clips!
.createEmptyMovieClip();
Hi...
Would any please give me a simple example of these 4 scripts:
Thanks in advanced.
Fla file please ....
.createEmptyMovieClip();
.createTextField();
.hitArea
.setMask();
Thanks for help.
.createEmptyMovieClip();
Hi...
Would any please give me a simple example of these 4 scripts:
Thanks in advanced.
Fla file please ....
.createEmptyMovieClip();
.createTextField();
.hitArea
.setMask();
Thanks for help.
CreateEmptyMovieClip
Is there a way to use a variable for an instance name in createEmptyMovieClip. For now this is what works:
_root.i++;
place="window"+_root.i;
_root.createEmptyMovieClip("window",i);
_root.window.attachMovie(section,place,i);
I would like to be able to do something like this...
_root.i++;
place="window"+_root.i;
window="section"+_root.i;
_root.createEmptyMovieClip(window,i);
_root.window.attachMovie(section,place,i);
Anyway of making that instancenanme a variable?
thanks
V.
Help With CreateEmptyMovieClip()
Hello,
First off - I am new to Flash & ActionScript. I origianlly had this script working when I only needed to create a single empty mc.
_root.Card1.createEmptyMovieClip( cardName, ( _root.Card1._level + cardNum ) );
_root.Card1.cardName._x = _root.Card1._x + 30;
_root.Card1.cardName._y = _root.Card1._y + 10;
_root.Card1.cardName.loadMovie( aCard.path, cardName );
I am trying to dynamically create a new mc but it does not seem to be working. When the variable cardname is no longer variable it works:
_root.Card1.createEmptyMovieClip( "cardName", ( _root.Card1._level + cardNum ) );
So, my question is this: how can I make this empty mc creating more dynamic?
Thanks,
Jim
CreateEmptyMovieClip HELP
I'm really trying to figure this out on my own but now I am ofically stumped.
When I press a button, I have figured out how to create the empty movie clip and load the external .swf into it.
on (release) {
_root.createEmptyMovieClip ("mc1", 1);
_root.mc1._x = 60;
_root.mc1._y = 35;
loadMovie("shot1.swf", _root.mc1);
}
What I cant figure out is how to make that empty movie clip move from one x position to another while the .swf is loading into it.
Is this possible?
Thanks in advance!
Pete
CreateEmptyMovieClip Help....
Hi fellow flashers. Yep it's friday night and I'm stuck on some code.
I am creating an EmptyMovieClip and loading an random external .swf into it like so:
_root.createEmptyMovieClip("mc1_mc", 1);
_root.mc1_mc._x = 360;
_root.mc1_mc._y = 0;
x = 0;
while (x == 0) {
x = random(10);
}
file = "movie"+x+".swf";
loadMovie(file, _root.mc1_mc);
on the next frame I am telling that movie clip that I created to slide:
_root.mc1_mc.onEnterFrame = function() {
_root.targX = 0;
cX = this._x;
difX = cX-_root.targX;
setProperty(this, _x, cX-(difX/6));
};
stop();
This works fine locally but when I uplaod it and test it remotely the movie loads but doesn't slide.
I'm thinking that I need to make sure the movie fully loads before I go to the next frame to execute the script that makes it slide??
Any help on this one would be really appreciated.
Thanks.
Pete
CreateEmptyMovieClip Behind Other MCs
I've got a fla with several layers containing my menu, header, content, etc. On the bottom layer I've got some code that creates an empty MC, loads a random jpg, and fades it in.
The problem is that the jpg loads on top of everything else, even though it is on the bottom layer and I have the layer specified to 1.
Heres the code with the problem:
// Create empty MC and load random jpgs
createEmptyMovieClip("bg", 1);
bg._alpha = 0;
bg.loadMovie("bgpicts/bg"+Math.ceil(Math.random()*9)+".jpg", "bg", 1);
And heres the rest of the code if you want to know:
// Checks to see if image is loaded and tells flash its there
this.onEnterFrame = function() {
BLoaded = bg.getBytesLoaded();
BTotal = bg.getBytesTotal();
percent = BLoaded/BTotal*100;
//Transforms jpg
if ((BLoaded == BTotal) && BLoaded>0) {
bg._xscale = 100;
bg._width = 750;
bg._height = 500;
bg._x = 0;
bg._y = 0;
//alpha fade in
this.onEnterFrame = function() {
_root.bg._alpha += 10;
if (_root.bg._alpha>=100) {
delete this.onEnterFrame;
}
};
}
};
Let me know if you want the fla
Thanks for your help,
Gabe
CreateEmptyMovieClip (as 2.0)
FlashMX
actionScript 2.0
Hi,
Here's my problem, I created a menu(all with drawing API)that expand and and collapse.
On rollOut I want to collapse. My rollOut event was on my button so each time that I rollOut from the button the menu collapse. Not very good IDea.
So I tried to create an emptyMovieClip and do the roll out on the emptyMovieClip. But It's transparent I don't see if it's well positioned.
I'm not sure how to place it and to do rollOut on an emptyMovieClip
Any clue or IDea
thanks
CreateEmptyMovieClip X And Y
Am having a problem positioning emptyMovieClip anywhere else other than top left-hand corner of main stage...
Code on button which loads a .SWF into emptyMovieClip is as follows:
on (release) {
_root.createEmptyMovieClip("shell", 1);
_root.shell.loadMovie("preload.swf");
_root.shell._x = 200;
_root.shell._y = 200;
}
But the Movie instance 'shell' always appears top left
Any ideas gratefully received.Thanks.
CreateEmptymovieclip ?
Im using action script to input a complex gallery into my flash site that has several pages in it..
the gallery imports lovely into the flash site and works great! BUT !then wen i want to view other sections in the flash site, like a biography for example, i click the button to redirect me to another part of the flash site and the gallery wont disappear and sits over the top of all my content.
I have no experience of using 'createEmptymovieclip' but im presuming the problem has something to do with this.
thats what the gallery has in it and the bottom of its actionscript :
_root.createEmptyMovieClip("empty", 1);
photoGallery(_root.empty/*path*/ .... + a load of other stuff for the size of the gallery display.
any help please.
cheers.
CreateEmptyMovieClip()
Its not working?
Im trying to create 30 MCs and load 30 jpgs to each one. i want the jpgs to match the MC instance name (_root.MC.p1 --> 1.jpg, _root.MC.p2 --> 2.jpg, etc.)
Heres what i tried:
code:
for (var c = 1; c<=30; c++) {
_root.MC.createEmptyMovieClip("p"+c, _root.MC["p"+c]);
_root.MC["p"+c].loadMovie(c+".jpg");
}
Thanks!
CreateEmptyMovieClip
hi,
i am having trouble creating a empty movie clip and putting it where i want to. i need the clip to be created at _root.main_mc.bg_mc.... but i can`t work out how to write this.
code:
var empty = this.createEmptyMovieClip("container", "100");
cheers,
G
Before CreateEmptyMovieClip
Hello,
I have built a simple preloader which loads a external swf file which is a video.
All of my actionscript is Flash 5 except for the createEmptyMovieClip command.
I am hoping to keep everything 5 so that people that haven;t updated thier Flash pug-ins won;t have to. Yes I am aware that it is easy and automated. But not everyone wants to update so I'm trying to make it most compatible.
My question is:
Before createEmptyMovieClip how did you load external swf's? I'm trying to keep everything Flash 5 or before.
Thanks for your help.
CreateEmptyMovieClip
Guys,
I am trying to set the position of a loaded movieclip, using the following code:
this.createEmptyMovieClip("container1",1);
container1.loadMovie("KClub2003.swf");
container1._x = container._y = 50 ;
Nothing is happening at all. Any suggestions.....please
5leander5
[F8] CreateEmptyMovieClip Woe
I am using this line of code....
_root.createEmptyMovieClip("mc"+_root.num,2)
where num gets incremented so I can have various different instances running.
Now the problem is that whenever I use this line it the other instance dissappears (even though the instance name is different)!
I am using the createEmptyMovieClip instances to draw a boxes (with lineto and beginfill and end fill).
ANY CLUES???
yours much appreiciated,
Daktau.
CreateEmptyMovieClip() [F8]
What i'm trying to do is dynamically generate a parent movie clip and then dynamically gernerate a series of child movie clips inside it.
My parent movie is created like this,
this.createEmptyMovieClip("parent", this.getNextHighestDepth());
And following child movies are created like
parent.createEmptyMovieClip("child1", this.getNextHighestDepth());
However if I were to try and load a movie or text into a child movie like this,
parent.child1.loadMovie("testMovie.swf");
Nothing happens
CreateEmptyMovieClip
_root.createEmptyMovieClip ("holder", _root.getNextHighestDepth());
_root.holder.loadMovie("background/background.swf", _root.holder.getNextHighestDepth());
_root.holder._visible = false;
How do I get the EmptyMovieClip (which had an .swf loaded into it) to not appear (_visible = false). The above script isn't working.
CreateEmptyMovieclip
Hi. I was trying to create a series empty moviclips that i would fill with dynamic images and then be able to click on each. (photo gallery)
I did manage to make a bunch of dynamically created movie clips. but when i try to add a onPress to any of the dynamically created movie clips nothing works
//heres how i create a box :
this.createEmptyMovieClip("imagebox01", 1);
this.imagebox01.loadMovie("http://i43.photobucket.com/albums/e359/stiqman/grdrmt.jpg");
this.imagebox01._x = 50;
this.imagebox01._y = 100;
//here's how i ASSUME you give a onPress so the button is clickable:
this.imagebox01.onPress = function() {
getURL("http://www.yahoo.com", "_blank");
};
but nothing happens... if i used on mouse down or on mouse up it acesses the link no matter where i click... what am i doing wrong here? ive tried this with on release also.
CreateEmptyMovieClip Help
where exactly does createEmptyMovieClip load its empty movieclip? I have a bunch of pictures I want to load into an array called pictureHolder, and when I execute the below code (I left some stuff out, like instantiation of the array, and moviecliploader), the pictures load.
However, if I create another empty movieclip at the root level, call it mcc, and tell pictureHolder[i] = _root.mcc.createEmptyMovieClip("imac"+counter...et c, none of the pictures load/are visible. Why? It's weird, the onLoadInit function does not seem to execute when I create empty mc's in _root.mcc, yet the pictureHolder array is still filled after executing.
PHP Code:
pictureHolder[i] = _root.createEmptyMovieClip("imac"+counter, this.getNextHighestDepth());mcLoader.loadClip("thumbnails/imac"+counter+".jpg", "imac"+counter);
CreateEmptyMovieClip
Hi, im new here, hope it's the right forum.
Anyways what I'm trying to do is on click of a button create an empty movie clip and allow that clip to be dragged around. With no specific number of movie clips, the user can click the button as many times as he wishes,
Here's the code i've written
Code:
// the code at root starts here
depth=0;
function allowMove(thePicture){
_root[thePicture].onMouseDown=function(){
onMouseMove=function(){
_root[thePicture+"._x"]=_root._xmouse;
_root[thePicture+"._y"]=_root._ymouse;
}
}
_root[thePicture].onMouseDown=function(){
onMouseMove=null;
}
}
//the root code ends here
//the code for the button starts here
on(press){
num=_root.depth+1;
_root.createEmptyMovieClip("picture_"+num, num);
_root["picture_"+num].loadMovie("http://pn-network.net/picgen.php?pics=pokemon&num=001&state=&gender=M");
_root.allowMove("picture_"+num);
}
//the code for the button ends here
Now when I click the button everything works fine. A movie clip is created, the image is loaded. BUT it wont allow me to drag or move the image. Can anyone help me out?
CreateEmptyMovieClip
PHP Code:
this.createEmptyMovieClip ("test_mc",10);
test_mc._x = 10;
test_mc._y = 10;
test_mc.loadMovie ("Beck.jpg");
test_mc.onPress = function(){
trace("here")
}
When I create a movie clip, with createEmptyMovieClip it doesn't work as a clip, in that it doesnt respond to the callback.
Am I doing something wrong or does the clip not behaviour like a clip when created like this.
Xml And CreateEmptyMovieClip
I've got some data in a xml file. It's got values that pertain to dynamically created movieclips. Among those values are numbers that are used to position those movieclips. I'm reading the xml successfully into my .fla file. Then I'm creating an array with the contents. That's also working as intended in that a trace or Debug/List Variables gives me what I'm looking for, though as you'll see below, as objects that are the likely source of my problem.
BUT...
When I access the numbers I'm trying to use to set the _x and _y positions of my movieclips by looping through the array, it fails. The clips are positioned at a value of 0 for both coordinates, even though that's not what's being assigned to the properties. If I trace the values I'm using to set those positions, I get the numbers I'm expecting from the XML data that's now an array. But I can't successfully assign those numbers to the new movieclips. The text strings that are being recognized and used properly.
I should point out that if instead of using XML, I just manually create the array in my .fla, that all works perfectly and that if I compare the trace of the .fla array to a trace of the XML originated array, that the results of the trace are identical. But the movieclip._x and movieclip._y positions are always 0 with the latter method. The one difference I see is that in the output window debug of variables, the values in the array turn up as being of "class 'XMLNode'", where when I trace the array I've manually created without XML, each value is a string or number as it should be. So that must be where the problem lies.
What do I need to do to get those numerical values to be properly recognized by my actionscript?
Here's a sample of the code that reads in the XML:
Code:
var my_xml:XML = new XML();
my_xml.ignoreWhite = true;
var myArray:Array = new Array();
my_xml.onLoad = function(success) {
if (success) {
for (var i = 0; i < this.firstChild.childNodes.length; i++) {
var currNodes = this.firstChild.childNodes[i];
var nestedArray:Array = new Array();
for (var j = 0; j < currNodes.childNodes.length; j++) {
nestedArray[j] = currNodes.childNodes[j].firstChild;
}
myArray[i] = nestedArray;
}
gotoAndStop("main");
}
}
my_xml.load("my.xml");
And a sample of output window info about the array when build from XML:
Variable _level0.myArray = [object #9, class 'Array'] [
0:[object #10, class 'Array'] [
0:[movieclip:_level0.sat0_mc],
1:[object #11, class 'XMLNode'] {
Some text info
},
2:[object #12, class 'XMLNode'] {
http://myurl.org/aaa.html
},
3:[object #13, class 'XMLNode'] {
80
},
When the array is not from XML, but from the .fla:
Variable _level0.myArray = [object #9, class 'Array'] [
0:[object #10, class 'Array'] [
0:[movieclip:_level0.sat0_mc],
1:"Some text info",
2:"http://myurl.org/aaa.html",
3:80,
4:20,
5:81,
6:20
],
Excuse the length of this. I suspect that it's an easy one for those more familiar with XML parsing than I am.
CreateEmptyMovieClip
When I create and attach a shape to a movie clip then its x, y are always at the 0,0 of the parent movieClip. But I hope it should be actually where it was drawn.
As in attached code I expect
//triangle_mc.x>200:200
in output window rather than
//triangle_mc.x>0:0
Attach Code
this.createEmptyMovieClip("triangle_mc", 1);
triangle_mc.beginFill(0x0000FF, 30);
triangle_mc.lineStyle(5, 0xFF00FF, 100);
triangle_mc.moveTo(200, 200);
triangle_mc.lineTo(300, 300);
triangle_mc.lineTo(100, 300);
triangle_mc.lineTo(200, 200);
triangle_mc.endFill();
//
trace("triangle_mc.x>"+triangle_mc._x+":"+triangle_mc._y)
Xml And CreateEmptyMovieClip
I have created an julia.swf file with a connection to an xml file using the xml connector component. The file has a dropdown where you can choose the name of a movie and a dependant textbox that populates with the movie details when a movie has been chosen. I have added no code to do this, just a Trigger behaviour and the properties in the component inspector. The file works perfectly.
In another file called navigation.swf I have some code that creates an empty movie clip then loads the julia.swf file. (I have pasted the code below). The file loads in but none of the components work. The dropdown wont even drop down, but it does have the first xml record displaying which makes me think it can still find the file.
The julia.swf, navigation.swf and the xml file are all in the same folder.
What is going on? I know it will be one of those simple things I could spent 17 hours looking at!!!
Please help me!!
Jo
newClip = function (movie:String) {
target.unloadMovie();
var nextDepth:Number = this.getNextHighestDepth();
this.createEmptyMovieClip("target", nextDepth);
target._x = 0;
target._y = 40;
target.loadMovie(movie);
};
this.julia_btn.onRelease = function() {
newClip("julia.swf");
};
(I don't think this code is the problem)
Odd CreateEmptyMovieClip Bug
thisi s a very simple snippet from a much more complex project, but it shows the problem I am having.
quote:function setupNextSlide() {
var newMC = this.createEmptyMovieClip("slide_"+this.getNextHighestDepth(), this.getNextHighestDepth());
trace("newMC after createEmptyMovieClip: "+ newMC);
setTimeout(setupNextSlide, 1000); // this fails
//setupNextSlide();// this works
}
setupNextSlide();
//setupNextSlide(); // works
//setupNextSlide(); // works
As it is, it will create the first movieclip, but createEmptyMovieClip returns undefined for all subsequent calls, but only using setInterval or setTimeOut. If I call setupNextSlide() recursively or repeatedly, it works. If I call another routine from the setTimeOut, which calls setupNextSlide, it works! so, I have a workaround, but t is Very Odd.
CreateEmptyMovieClip
Out of curiosity, what would occur if you were to call
this.createEmptyMovieClip("myMCArea", this.getNextHighestDepth()); more than one time?
Would you have 2 movie clips called myMCArea? If so how would you reference one over the other?
Not that I would do this, but I am wondering if Flash has a built in protection against accidentally trying to use the same name twice?
Kind of like
var asd:String = "a";
var asd:Number = 0;
To me this should throw an error as you are declaring the same var twice. If one was global and one was local then I'd say it was ok, but with both being set on a global level I would expect Flash to not like this.
Using CreateEmptyMovieClip()
c_mc2 = _root.createEmptyMovieClip("main_text", 4);
c_mc2._x = 0;
c_mc2._y = 359;
If i use this method to create an empty clip and then once i am done with the clip i unload the movie which was previously in it, what happens to the clip. Do i have to re-create it if i want to reuse the empty movie clip again with the same name?
please help me someone!
Using CreateEmptyMovieClip
What's the difference of using between _root["mc"] and declaring a variable to createEmptyMovieClip?
here's of what I mean:
_root.createEmptyMovieClip("toto_mc",1);
_root["toto_mc"]._x = 0;
_root["toto_mc"]._y = 0;
_root["toto_mc"].loadMovie("ruban.swf",1);
var toto = _root.createEmptyMovieClip("toto_mc",1);
toto._x = 0;
toto._y = 0;
toto.loadMovie("ruban.swf", 1);
Both seem to do the same. Does anyone have any ideas? I'm just curious to know...
CreateEmptyMovieClip?
Got a quick one here, I have 2 frames in a my fla, and here is what frame 1 looks like:
this.createEmptyMovieClip("my_mc_1", 10);
with (my_mc_1){
_x=0;
_y=0;
}
my_mc_1.attachMovie("frame1Image", "image1", _root.getNextHighestDepth());
stop();
I also have a button on the stage with this in it:
on(release){
my_mc_1.removeMovieClip()
gotoAndPlay(2);
}
I also have a button to go back to frame 1 in frame 2, problem is that after a while of going back and forth from frame 1 and 2, the movieclip my_mc_1 appears in frame 2, which its not supposed to.
basically when you hit frame 2, you should never see the image, but it still appears
anyway around this??
thanks
CreateEmptyMovieClip()
Hi,
I'm trying to tackle the "Loading techniques " tutorial and it works well. The only thing is that the pictures keeps appearing on top of my entire flash site. I want the loaded swf to open on a predefined layer so it won't mess up my layout. Can somebody tell me how I can blend a loadMovie(swf) into my site?
Thanx
Using CreateEmptyMovieClip()
c_mc2 = _root.createEmptyMovieClip("main_text", 4);
c_mc2._x = 0;
c_mc2._y = 359;
If i use this method to create an empty clip and then once i am done with the clip i unload the movie which was previously in it, what happens to the clip. Do i have to re-create it if i want to reuse the empty movie clip again with the same name?
please help me someone!
CreateEmptyMovieClip
hey people i have one litlle problem i bet its real easy and im missing some thing
i am calling a SWF from same folder as my flash file...
i do the createEmptyMovieClip thing but the problem is that i only hear the sound of my file and I dont see the images....
i have the depth set to get nexthighestdeph
(no errors in my code )
I try setting the layer to streaming but its not working so can anyone tell me what im doing wrong!
please....
thanks in advance !
-Ronnie
CreateEmptyMovieClip
Hi,
I'm trying to create a button dynamically. I'm trying to use a createEmptyMovieClip method to create a "movie clip" and then giving it an onRelease event handler. But this doesn't seem to work.
But when i make a movie, add it to the library and then attach it through attachMovie method, then the onRelease method seems to work.
Any ideas on why i can't do this?
Also, when i create a movie using createEmptyMovieClip and hten loadMovie(jpg) it loads correctly. But when I createEmptyMovieClip and hten specify it's width and hten try the loadMovie method, it doesn't seem to load it....
Any help in either of these issues will be great.
Thanks,
CreateEmptyMovieClip() And For..
Hi,
AS 2.0 code is very simply and like that;
ActionScript Code:
for(var i:Number=0;i<10;i++){
var mc:MovieClip=createEmptyMovieClip("mc"+i,i);
mc._x=i*10;
trace(mc._x);
}
But AS 3.0? How we gonna write this code?
Like that?
ActionScript Code:
for(var i:int=0;i<10;i++){
var mc:MovieClip=new MovieClip();
mc.name="m"+i;
mc.x=i*10;
trace(mc.x);
}
Or like that?
ActionScript Code:
for(var i:int=0;i<10;i++){
var mc:MovieClip=new MovieClip();
mc.name="m"+i;
mc.x=i*10;
addChildAt(mc,i);
trace(mc.x);
}
Or how?
[as1 Or As2] CreateEmptyMovieClip Help
Hey all,
I'm trying to do this on the _root level:
Code:
this.createEmptyMovieClip("form_mc", 1);
form_mc.createEmptyMovieClip("image", 1);
loadMovie("210-1.jpg", form_mc.image);
the swf and jpg are in the same directory, but as of yet, no luck. Can this work? Is it possible? I asked almost the exact same question 6 months ago and got no answer. HELP!!!
Che
This.createEmptyMovieClip
Ok, please tell me if this will work at all?
Code:
//Creating the XML driven menu
var xml:XML = new XML();
xml.ignoreWhite = true;
xml.onLoad = function(success) {
if(success) {
menu = this.firstChild.childNodes;
for(i=0;i<menu.length;i++) {
this.createEmptyMovieClip('butTemp',+i,i);
butTemp.createTextField('but_txt',+i,i,20,10);
var format:TextFormat = new TextFormat();
format.color = 0xffffff;
newBut= _root.attachMovie('butTemp','but'+i,i);
newBut._y = 150;
newBut._x = (i*50)+50;
newBut.but_txt.text = menu[i].attributes.label;
}
} else {
trace('error loading the xml document');
}
}
xml.load('xml/menu.xml');
My goal is that instead of creating a movie clip and placing it in the libary i can instead create it via actionscript (with the textfield inside of it) and then attach this newly created movieclip to the stage depending on the items in my xml file
Code:
<?xml version="1.0" encoding="iso-8859-1"?>
<menu>
<btn label="home" colour="#ffffff"/>
<btn label="about" colour="#cccccc"/>
<btn label="portfolio" colour="#999999"/>
<btn label="articles" colour="#666666"/>
<btn label="contact" colour="#efefef"/>
</menu>
Am i coding this correctly?
If not then please show me what i'm doing wrong atm :D
CreateEmptyMovieClip
just a fast q, is it possible to do "createEmptyMovieClip" in a specified location in teh flash file? if so what is the syntax?
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
SetMask With CreateEmptyMovieClip?
Hi Flash World,
I'm creating an empty movie and after that I set this created movie as a mask to another movie.
f.i:
_root.createEmptyMovieClip ("floor", 1);
... lineTo and beginfill to create a black square ...
_root.mymovie.setMask(_root.floor)
The problem is that I don't want to set all the square as a mask... all its inside part ... I'd like to put that square as mask but with a circle inside that it wouldn't be possible to see through it...
What I want is to create a Mask with createEmptyMovieClip, some geometrical drawing inside and some parts of it to be possible to see through them and others no... is it possible? has something to do as when I create a gif with some color set to be transparent?
Thank you very much for your time.
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.
CreateEmptyMovieClip From An Object
hi
i wrote a bit of actionscript to generate a grid of blocks - (it's going to be used for a menu at some point) - it displays a 5x5 grid - if there are more than 25, they go on to the next page - working example: http://www.landingnet.co.uk/grid.swf
(the green blocks are the buttons)
(& it's not meant to be pretty ;-))
anyway - i'm trying to convert it to oop so i can have a few of them running in the same movie at the same time (an oversight on my part) - but i can't get it to work
http://www.landingnet.co.uk/grid.fla - working, non - oop
http://www.landingnet.co.uk/grid_oop.fla
the problem is that i can't get my head round how to create an empty clip from inside the object -
//
function menuCreate(total, rowCap, colCap) {
this.sect = sect;
this.total = total;
this.rowCap = rowCap;
this.colCap = colCap;
this.pageNum = 1;
this.currentPage = 0;
this.count = 0;
this.pageCap = Math.ceil(total/(rowCap*colCap));
this.pos = 10;
this.newPage();
}
//
function page() {
if (this.total>0) {
trace(this.total);
this.pageName = "holder"+this.pageNum;
trace(this.pageName);
this.createEmptyMovieClip(this.pageName);
this.tag = eval("_root.holder"+this.pageNum);
trace("tag: "+this.tag);
}
}
//
menuCreate.prototype.newPage = page;
cd = new menuCreate(45, 5, 5);
cd.newPage;
//
this code will trace out the total and pageName, but won't do eval("_root.holder"+this.pageNum); - which leads me to suspect the clip is not being created as i want it to
any help will be greatly appreciated
|