Create A 3 By X Grid With AttachMovieClip
Hi, how do i attachMovieClips so it say puts 3 across then goes underneath that and puts another 3 and so with an unknown amount of mcs...
Im creating a gallery with xml and i want the buttons that load the pictures to appear with a set Interval in this way...
any ideas or tutorials in this sort thing that poeple know of would be great news to me....
Thanks
Stephen
Ultrashock Forums > Flash > ActionScript
Posted on: 2004-12-02
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
[MX04] Create And AttachMovieClip Problem -
So here is what i want to do:
-I have an XML that i load containing filenames of images
-Then I create emptymovieclips on the stage and make them load the images
This is done to Preload the images into the movie.
Later in the Movie i have Menuitems (as Movies).
Within this Menuitems is another movie, stopped on frame 1.
Rolling over the Menuitem makes the nested movie go to frame2
Frame 2 contains a empty Movie as "placer" where i want to attach the created movies from root containing the image
On root after loading and parsing the xml i have:
Code:
for (i=0;i<10;i++){
var mc:MovieClip = _root.createEmptyMovieClip("img_"+i,this.getNextHighestDepth());
// place outside stage
mc._x = -1000;
var url = _root.imageurl[i];
mc.loadMovie(url);
}
This is fine so far, images get loaded.
Now within the placer I have:
Code:
onClipEvent(load) {
id = _parent.id; // Get id of the ClipContaining the correct Image
this.attachMovie("_root.img_"+id,"holder",this.getNextHighestDepth());
}
and this does not work....well I tried different configurations, but
I have the impression that I'm going wrong somehow.
Any suggestions?
Create Big Grid HOW?
Hello,
I want to make a big grid (100x100 or maby 500x500);
I tried this with duplicatemovieclip but in that case even a big computer can not handle it.
The grid can be build out of an array. All gridblocks should be white (0) and on mouse press and over they should change color (do I really need duplicatemovieclip for this?) in black.
We have no problem with handling the data (arrays) back and forward into flash but this grid is driving us crazy.
Simply said: it's should be something like a drawinggrid where i have to compare different made grids out of a database.
When somebody has an idea or solution it whould be great to read!
Create Grid In FlashMX
i would like the user to create a room, WIDTH textfield and HIGHT textfield. For example, the user types in hight=10 and width=5 in textfields and then click a "calculate" button and it to create a grid with those measurements.
Create A Grid Pattern
Hello, I am working on this flash header for a website...
http://www.videolinktechnologies.com/movie.swf
I need some kind of decoration in the background instead of just having solid blue...
Anyone know how to make a "grid pattern" in the background?
I turned on the grid and traced the lines... but the lines keep snapping to each other and it takes forever... especially if you use small squares...
Any ideas? Or anyone know how to make a grid of squares easily?
thanks
Create A Grid With A For Loop.
I can't figure this out.
Let's say I have a movie clip of a square in my library and I want to use a for loop to create a 10x10 grid of those squares. How do I approach that?
Spacing each square horizontally or vertically isn't a problem for me but I'm hung up on how to add 10 squares and then start a new line.
Can I do it all with a for loop?
Create A Grid Pattern
Hello, I am working on this flash header for a website...
http://www.videolinktechnologies.com/movie.swf
I need some kind of decoration in the background instead of just having solid blue...
Anyone know how to make a "grid pattern" in the background?
I turned on the grid and traced the lines... but the lines keep snapping to each other and it takes forever... especially if you use small squares...
Any ideas? Or anyone know how to make a grid of squares easily?
thanks
Create A Grid Using AttachMovie
I'm having some problems trying to adapt some code, kindly produced by Redivider some time ago. The code:-
COLS = 4; // number of columns in grid
ROWS = 4; // number of rows in grid
SPACING = 20; // spacing between circles in pixels
LEFTMARGIN = 10;
TOPMARGIN = 10;
DEPTH = 0; // starting point for depth
for (i=1; i<=ROWS; i++) {
for (k=1; k<=COLS; k++) {
current = attachMovie("circle", "circle"+i+"_"+k, DEPTH++);
current._x = LEFTMARGIN + ((k-1) * (SPACING + current._width));
current._y = TOPMARGIN + ((i-1) * (SPACING + current._height));
}
}
sets up a grid of 4 circles wide x 4 circles deep. This works very well, but what I need to do is to address each movieclip separately, so that I can set up actions for each of them in 'onEnterFrame'. What I've tried to do is change, which doesn't work:-
for (i=1; i<=ROWS; i++) {
for (k=1; k<=COLS; k++) {
current = attachMovie("circle", "circle"+i+"_"+k, DEPTH++);
current._x = LEFTMARGIN + ((k-1) * (SPACING + current._width));
current._y = TOPMARGIN + ((i-1) * (SPACING + current._height));
}
}
to:-
for (i=1; i<=ROWS; i++) {
for (k=1; k<=COLS; k++) {
attachMovie("circle", "circle"+i+"_"+k, DEPTH++);
clonePath = "circle"+i+"_"+k + DEPTH;
clonePath = LEFTMARGIN + ((k-1) * (SPACING + clonePath._width));
clonePath = TOPMARGIN + ((i-1) * (SPACING + clonePath._height));
}
}
Does anyone have any ideas? I would greatly appreciate some help.
I'm using Flash MX
Thank's in advance,
Philippa
How To Dynamically Create A Grid?
Hi everyone. New here, and new to AS3.
What I'd like to do is create a grid. I'm kinda stuck though. I think I know the basic idea behind it, using arrays, but I'm not sure how I can get something like that to work. Let's say I have an array of 5 different-colored squares, and I'd like a grid of 25, randomly generated, centered on the stage.
Here's the starting code I have:
Code:
function createGrid(e:Event):void {
trace("Creating grid");
removeEventListener(Event.ENTER_FRAME,createGrid;
var myArray:Array = [A_mc, B_mc, C_mc, D_mc, E_mc];
for(var i:Number = 0; i < myArray.length; i++) {
myArray[i].addEventListener(MouseEvent.MOUSE_OVER, boxOver);
myArray[i].addEventListener(MouseEvent.MOUSE_OUT, boxOut);
myArray[i].buttonMode = true;
}
}
Obviously I'll want the squares to do something on a MOUSE_OVER, but I can do all that later.
Anyway, now that I have my array started, how can I arrange them dynamically, and create 5 rows and 5 columns?
I've looked everywhere, and I have some sample source code to a few things I've found, but they're far more advanced for the time being.
Any help is greatly appreciated.
Using Nested For Loops To Create Grid
hi.
im having problems creating a grid with 5 columns and n rows. im using a nested for loop to try and do it. i think im close but cant figure out where im going wrong. can anyone see anything obvious at first glance?
Code:
var len = myArray.length;
for ( var i=0; i<len; i++ )
{
for( j = 0; j < 5; j++ )
{
var o:MovieClip = extThumbnails.attachMovie( "extThumbnail", "t"+j, i+j);
o._x = 29 * i;
o._y = 25 * j;
}
}
thanks. -- fumeng.
Create A Grid For Use As A Mask And Other Stuff
Hi this is my first post. :-) I read through just about all the posts in this forum today and I could not find a direct answer to my query.
This is basicaly what I want to do. I want to create a grid made of little boxes. I want each box to be an instance of a library item and each box should have a unique name (box1, box2, box3 ...) For now lets say its a 10x10 grid of 100 boxes.
Ok I have that part done. The code that I used ( thanks cyanblue ) is at the bottom of this post.
I place the code on an MC called grid and then I placed an instance of that MC on the main timeline and called it grid.
Problems.
1) I thought that if the grid was on a layer that I designate as a mask, it would mask the layers below it.
2) I want to be able to pick a box either randomly or through a FOR loop and change its properties. For instance change each ones color one at a time to get a cascading effect. For some reason from the main timeline :
grid.box1._x = 200;
does nothing?
You dont have to write the code for me, I have to learn it :-) but I do need a pointer in the right direction.
thanks :-)
*****************************************
colWidth = 10;
rowHeight = 10;
cols = 10;
rows = 10;
counter = 0;
for (col = 0; col < cols; col++)
{
for (row = 0; row < rows; row++)
{
this.attachMovie("box", "box" + counter, 150 + counter);
with (this["box" + counter])
{
_x = col * (colWidth * 2);
_y = row * (rowHeight * 2);
}
++counter;
}
}
Photoshop Script To Create Grid
I learned a little about the (surprisingly) simple Photoshop Javascript API today, and wrote a little script to do what had always driven me nuts before.
Code:
/*
<javascriptresource>
<name>Create Grid</name>
<about>Create a layer that is solid minus a grid of a certain value repeating both horizontally and vertically.</about>
<enableinfo>true</enableinfo>
</javascriptresource>
*/
// Warning: Don't change this
const GRID_HORIZONTAL = 1
const GRID_VERTICAL = 2
const GRID_BOTH = GRID_HORIZONTAL | GRID_VERTICAL
// But do change this.
const GRID_SIZE = 72
const GRID_LINES = GRID_BOTH
const GRID_OPACITY = 40.00
const GRID_LAYER_NAME = "Grid"
// And don't change anything below this
function selectGrid(document, size) {
document.selection.selectAll()
// Cut vertical lines
if ((GRID_LINES & GRID_VERTICAL) == GRID_VERTICAL) {
for (var i=0; size*i+1 <= document.width; i++) {
document.selection.select([
[size*i, 0],
[size*i+1, 0],
[size*i+1, document.height],
[size*i, document.height],
[size*i, 0]
], SelectionType.DIMINISH)
}
}
// Cut horizontal lines
if ((GRID_LINES & GRID_HORIZONTAL) == GRID_HORIZONTAL) {
for (var i=0; size*i+1 <= document.height; i++) {
document.selection.select([
[0, size*i],
[0, size*i+1],
[document.width, size*i+1],
[document.width, size*i],
[0, size*i]
], SelectionType.DIMINISH)
}
}
}
function createGrid() {
// Use pixels
var originalUnits = preferences.rulerUnits
preferences.rulerUnits = Units.PIXELS
var docRef = app.activeDocument
var gridLayer = docRef.artLayers.add()
docRef.activeLayer = gridLayer
gridLayer.name = GRID_LAYER_NAME
gridLayer.opacity = GRID_OPACITY
selectGrid(docRef, GRID_SIZE)
docRef.selection.fill(app.foregroundColor)
docRef.selection.deselect()
// Clean the memory
docRef = null
gridLayer = null
// Reset the preferences
app.preferences.rulerUnits = originalUnits
}
// Start the script
if (app.documents.length > 0) {
createGrid()
} else {
alert("You must already have an active document.");
}
Put this in the Photoshop CS3 folder/Presets/Scripts, and then restart PS; it should be available through the File -> Scripts menu as “Create Grid.” Alternatively, just place it wherever you like, and use the Browse menu item under the Scripts menu to load it manually.
I don’t think there’s any way to launch a (pretty) dialog through the API, so the preferences are currently just in the script; hopefully they’re relatively intuitive. It just creates a grid on the top of your file of the specified size.
This is useful because unlike the built-in grid which doesn’t actually have pixels that it uses, this does. So, the built-in grid has funky snap issues where the aliasing can quickly get ugly.
I got the idea from some grid-focused designer a while back … can’t seem to remember his name anymore, though.
How To Create A Grid/table Using Action Script?
Hi all,
As am new to Flash I need coding help to overcome the following issue, how can we draw a table with some numbers in Flash using action script ? What are the methods to be followed to attain the solution? As am working with flash lite datagrid is not supporting.
Thanks in advance,
Cbe.
How To Create A Column Header In A Grid Using Action Script?
Hi all,
I have tried to draw a grid like thing in flash using action script with the help of looping, how can i change the color of the first row in the grid? plz help me in coding. I have shared the coding here.... this will create a table like structure with 5 rows and columns with some random numbers inside each cell.
for (var i = 1; i<=5; i++) {
for (var j = 1; j<=5; j++) {
counter++;
// We attach the movie clip on the stage
grid_container.attachMovie("cellMCs", "cell"+counter, counter);
// We assign a _x position to the cell
grid_container["cell"+counter]._x = initX;
// We assign a _y position to the cell
grid_container["cell"+counter]._y = initY;
grid_container["cell"+counter].randomNumber.setNewTextFormat(txtFormat);
// We generate a random number that we display in the dynamic text field of the cell
grid_container["cell"+counter].randomNumber.text = Math.floor(Math.random()*9)+1;
trace(grid_container["cell"+counter].randomNumber.text);
// We assign a onRelease event to the cell
//grid_container["cell"+counter].onRelease = function() {
//cellName.text = this._name;
//};
initX += 30;
}
initY += 30;
initX = 0;
}
Thanks in advance,
Cbe.
Good Way To Dragdrop Mc To A Sticky Grid With Grid Cells That Animate.
Is there a way to get mc._dropTarget to recognize a hidden MC it drops on?
I have am trying to drag drop a movie clip item onto a 9 by 6 grid. The user should not see the grid. Each grid cell has a number of properties, including an animation that plays in it depending on what is dropped in it. What is the best way to do this. I came up with two ways:
A. Do the math:
1. Figure out what the drop point x and y values would convert to in the grid to find the grid cell it applies to.
2. Attach a new movie clip animation to that cell's centered x,y point to show something happened there.
B. Fill the grid with Movie Clips:
Use the mc._droptarget to see what grid cell movie clip was dropped on and then change its animated state to show something happened there.
The problem with A is that it is a little slow and cumbersome.
The problem with B is that I can't let the user see the cell movieclips. mc._droptarget only works to detect if a mc was dropped on visible graphic area of another mc as far as I can tell.
I could sure use some help on this. Is there a better way?
- Wade
Grid Thumbnail With Dynamic Grid Lists
After 3 days of browsing and searching any sollution for my problem I decided to ask you directly here. I really like the thumbnail gallery for its simplicity and beauty. But I would like to ad or vertical scroller (I'm unable to find it here too, maybe I'm blind, just I'm more at the end of my seeking options) or a make a grid thumbnails, that will show 2 columns of thumbs and 5 pictures in each columns, then under the 2 columns i would like to ad a sort of arrow or button that if my gallery have more then 10 pictures it will go on the next thumbnail list. I'm not looking for any extra fading effects or special movements. Just would love to have a single thumbnail grid on side, with option to have lists of thumbnails by 10 if there is more then 10 pictures or so. If somebody can please redirect me or help me I would be very happy, also other ppl here that are seeking for the similar. thank you
Help With Accessing Grid Spaces In A Grid
Hi Guys
I need a bit of help with my coding. I'm building a small editor that allows users to place electrical components onto a grid so that they can see how electricity works. I have built a grid using an array and for loops and attach movieclips dynamically to that grid. What I want the moviclips to do is to look in the four spaces either side of itself i.e. up, down, left and right. I have managed to pull the grid coordinates out of the grid which enables me to tell the clip which grid space to look at but have been unable to successfully get the code to work.
Here is my code:
myGrid = [[1,1,1,1,1,1,1,1],
[1,0,0,0,0,0,0,1],
[1,0,0,0,0,0,0,1],
[1,0,0,0,0,0,0,1],
[1,0,0,0,0,0,0,1],
[1,0,0,0,0,0,0,1],
[1,0,0,0,0,0,0,1],
[1,1,1,1,1,1,1,1]];
var board:Object=new Object();
board.tileWidth = 30;
board.tileHeight = 30;
board.depth = 1;
board.path = this.grid;
function buildGrid(map){
var mapWidth = map[0].length;
var mapHeight = map.length;
for (var j:Number = 0; j<mapHeight; ++j){
for (var i:Number = 0; i<mapWidth; ++i){
var Tilename:String = "cell"+j+"_"+i;
var x:Number = i*board.tileWidth;
var y:Number = j*board.tileHeight;
var type:Number = map[j][i];
board.path.attachMovie("tile", Tilename, ++board.depth);
switch(type){
case 0:
board.path[Tilename].dropable = true;
break;
case 1:
board.path[Tilename].dropable = false;
break;
}
board.path[Tilename]._x = x;
board.path[Tilename]._y = y;
board.path[Tilename].gotoAndStop((type+1));
//trace(board.path);
//trace (i);
var depth:Number = 2001;
power.onPress = function(){
this.startDrag();
}
power.onRelease = function(){
this.stopDrag();
trace("drop - "+this._droptarget);
var drop_target = eval(this._droptarget);
if (drop_target != null){
if (drop_target.dropable ==true){
//drop_target.gotoAndStop("topsource");
trace("drop on tiles");
trace("we are dropped!");
this._x = 250;
this._y = 60;
_root.board.path.attachMovie("powersource2_mc", "powersource", depth);
_root.board.path.powersource._x = drop_target._x;
_root.board.path.powersource._y = drop_target._y;
_root.board.path.powersource.onPress = function(){
_root.board.path.powersource.startDrag();
_root.board.path.powersource.swapDepths (2001);
}
_root.board.path.powersource.onRelease = function(){
//this code gets the grid/cell/i_j reference and converts it to numbers that
//gives the x and y position within the array
var gridPos = this._droptarget;
var xcellRef = gridPos.substring (12);
var ycellRef = gridPos.substring (10, 11);
//these variables turn the string values into numbers
var Gridx:Number = xcellRef - 0;
var Gridy:Number = ycellRef - 0;
trace ("current x position is::" +Gridx);
//trace ("curent y position is ::" +Gridy);
//var gridCheck:Number = Gridx+1;//check to the right
//trace ("the square on my right is::" +gridCheck);
if (Gridx+1 == _root.board.path.brightlamp){
trace ("something is there!");
}else{
trace ("nope nothing here!");
}
snapto=30;
_root.board.path.powersource._rotation += 90;
Newx = Math.round(_root.board.path.powersource._x/snapto)*snapto;
Newy = Math.round(_root.board.path.powersource._y/snapto)*snapto;
_root.board.path.powersource._x = Newx;
_root.board.path.powersource._y = Newy;
stopDrag();
}
}else{
this._x = 250;
this._y=60;
}
}
}
}
}
}
buildGrid(myGrid);
sorry about the long post but any help will be greatly appreciated!
Tegalad
Grid Marker Not Data-grid
Hi Geeks!
Curious to know if its possible to created grid like marker over an image within Flash?
Have a look at attached image
How Do You Use Attachmovieclip?
Hello there, I recently learnt of the attachmovieclip command but haven't been able to use it. I'm assuming this command allows you to run a movie clip that is in the library without having to place it on the stage. I have a Flash movie that contains four scenes; each scene only has five frames. I want a 20-frame movie clip that is in the library to run over/span the four scenes. If anyone can tell me the set up procedure for this I would really appreciate it. Thanks!
K.Rice
Attachmovieclip
Please help me. At the moment I'm trying to make a shooter. I already buid the script that can follow my mouse. I programmed it that if I click a bullet will be fired (This is also a movieclip) The code that I used:
onClipEvent (mouseUp) {
_root.gotoandplay (2)
}
On frame 2 of the main timeline i made the following:
this.attachMovie("Schot", Knal, 1);
Xwaarde = _xmouse;
Ywaarde = _ymouse;
setProperty (Knal, _x, Xwaarde);
setProperty (Knal, _y, Ywaarde);
_root.gotoAndPlay (1);
But when I fire, the bullet isn't going to the right place. The first time I shoot it's good but the second time it fails!
Please help me!!!!
Attachmovieclip
i attached a movieclip using attachMovie
_root.attachMovie("ball", "spot1", 1)
now how do i change its location?
i cant figure it out.
Attachmovieclip Help
How can I make a movie clip attach to the mouse, then, when a key is pressed, a completely new movie clip is attached to the mouse. When the key is pressed again, it removes the new movie clip and attaches the old movie clip to the mouse? I would really appreciate it if any of you could figure it out. Thanks.
AttachMovieClip
Hey,
I was wondering if there was a way to specify an x and y value when attaching a movie clip to another. Say if I had a movie clip called stage and used it as my stage, could I attach movieclips to specific places on the stage movieclip?
Thanks
Jay
Attachmovieclip
Hi there, i am using flash mx 2004 and i wondered if there is any way to attach a mc from library to load in which frame you want. Thanks
AttachMovieClip
hello,
need help. when attaching a mc to the stage, how do i reference the time line in the mc attached? i am using the same code in the main time line with _root. i put the same code in the attached mc but took out _root cause i do not want to use the code in the main time line. the code i need to work is in the mc attached. i have tried home, _parent, this, but none seem to work. would someone be kind to let me know what im doing wrong? thanks
AttachMovieClip Help
hey guys, first post here so be nice
im making a top down racing game whereby the car stays in the same y position and the obstacles / enemies are generated and come from the top, i have managed to code in a rock that generates and falls from the top of the screen, and collides with the user if they dont move out of the way. What i cant work out is how to be able to make duplicates of the clip every time my distance variable gets to a certain number, and have it perform the same actions as the original. any links to tutorials that might help me, or any help from yourselves would be much appreciated
Mat
AttachMovieClip
Hola!
I'm using duplicateMovieClip to randomly generate and duplicate a certain MC on the stage of my movie.
In theory, I thought I could use attachMovieClip(); to attach an MC from the Library (with linkage identifier of course) to a different MC on the stage, setting a higher level for this attached MC than that of the MC w/the duplicateMovieClip(); command.
Thus, the MC attached from the library would, in theory, reside on a level higher than that of all of the duplicated MC's.
Unfortunately, when I use attachMovieClip and set the level to 100 (or even 999 for that matter) the MC being duplicated (and all duplicated instances) are still on a higher level than the attached MC which is being set to a much higher level?
I'm baffled! Please help!
Thanks in advance.
Attachmovieclip Only If?
Hey everyone. I'm working on a website currently that has 3 container clips in it, where other .mc's load depending on navigation. Everything works great, except for one thing...
The .mc's that work are basically just pics. I also have a scripted phototransition that calls on an .xml file. They work fine except that if I click on a button that is meant to call them into the container clips and they are already there, they duplicate down and to the right on top of the current clip. I end up with a cascading pic transition MESS...
Anyone have any idea what the deal is? I assume I need to completely empty the container clip, and then place the .mcs back into it, but I can't get it to work!!!
Here is the actionscript for the buttons, where movie1, movie2, and movie3 are the pic transition movies:
on (release) {
container1.attachMovie("movie1", "newname1", 0);
container2.attachMovie("movie2", "newname1", 0);
container3.attachMovie("movie3", "newname1", 0);
Thanks in advance!
AS3 Vs AS2 AttachMovieClip
In the previous version of ActionScript, it was possible to do attachMovieClip("myLinkageName") now we can do new MyLinkageName(); where MyLinkageName refer to a Class.
My question is more about a for loop like this:
// AS2
for(var i:Number; i < 5; i++)
this.attachMovieClip("myLinkageName_" + i);
How to do that in Flash if my objects are named like MyLinkageName_0, MyLinkageName_1, etc
Thank's for youyr help
Help With AttachMovieClip
i know how to attach a Movie Clip in one line i did this code
for(i=0; i<10; i++) {
_root.attachMovie("ball","ball"+i, i);
_root["ball"+i]._x=i*_root["ball"+i]._width;
}
so this clip will generate 10 MovieClip in one line
the one i really want to do is i want 10 lines
and each line that will make 10 Movie Clip
how can i achieve this??
AttachMovieClip
when i use attachMovieClip, is there some way i can make it go ontop of the old clip. so that when the new one is finshed "building" over it i can remove the old one, preventing a stackup????
AttachMovieclip
Hi!
I have attached a clip which contains other clips. I can make these clips move but if I want to use them as buttons it doesn't seem to work. I have tryed to use the myMovieClip.onRollOver but without success. What do I have to do to make them react on the mouse?
HELP!
Thankx
Johan
AttachMovieclip
Can someone explain to me the advantage of linking a movieclip and then using the attachMovieclip function instead of just placing the movieclip on the stage in the first place? Does this affect your file size when you publish your movie. I've been watching some movies from lynda.com and they show you how to do this but don't explain the why or when.
Array To Attachmovieclip?
i have an array (this is just a test)
Code:
map = new Array();
map = [[1], [2], [3]];
and i want some code that goes through it and if it = 1 attach movie 1 or if it is 2 attach movie 2 and so on??? how is this done??
AttachMovieClip Question
hi,
i have the following problem : a movieclip in a scene attaches another mc by calling
_root.attachMovieClip('clip','clipat',1);
'clip' itself has a little animation over 15 frames, but after the mc gets attached this animation doesn't run in the scene where i attach it. i just see the first frame of the mc, then it stops.
can anybody help me with this ??
cheers,
alex
Variables And AttachMovieclip
Hi folks:
Can anyone help me out with this problem.
I am creating a flash file to be used by our sales staff which shows our
sales regions within the US. Each region has X # of states in them. Each
region is its own movie clip. When you click on a button associated with the
state three movie clips are loaded. I manually load the first clip which is
called state_template (and then give it a name based on that state (i.e.
maine_temp).
The only thing I use this for is so I can layer the following two mc:
stateBorderTemplate and then a movie clip based on the state button
selected (i.e. maine_mc).
i use the code below:
this.attachMovie( "stateBorderTemplate", "border0", 1);
this.border0._x = 0;
this.border0._y = -185;
//object.prototype.stateName is a global variable that is set when you
release the state button
if (object.prototype.stateName == "maine") {
this.attachMovie( "maine_mc", "maine0", 0);
this.maine0._x = -30;
this.maine0._y = -5;
}
On the stateBorderTemplate there are a series of buttons that highlight
specific sales regions within a state, allow you to navigate around the map
and to zoom in and zoom out. All works well but as you can see, when I start
adding the other fifty states I am going to run into a lot of code. I want
to do this programmatically but I seem to be running into a problem passing
the variables.
On one of the navigation buttons I tried this in various concoctions with no
positive results:
mapToGet = "_parent." + object.prototype.stateName + "0";
trace (eval(mapToGet._y) + " " + _parent.maine0._y);
The stateName in this case is "maine" and so I think the two results I
should get in my trace would be identical (in this case -5) What I get is a
blank and -5. Its only returning the hard coded one. Is there something else
I need to do to the string I am passing (or conversly something i am doing
which I shouldn't) or does this not work with attached movie clips.
Any help would be appreciated
Thanks
Steve
Attachmovieclip Maximum?
Hi guys
It seems to me that there is a maxium of attachmovieclips that Flash is performing.
i've got a movieclip which at a certain frame attaches the same movie to it,parent. when flash reaches to 256 it stops ?? i canot find any documentation on this ??
does any body know something about this??
Attachmovieclip.my.butt
Yargh!
Here's what I have: an introduction with 7 buttons. I want each button to:
Open a scene or movie clip that places a background (it fades in) and
launches a corresponding movie on that background
When that movie clip is done, buttons across the bottom will:
open a new movie clip (on the same background)
and close the other movie clip.
I have had success with placing a blank MC on my background and attachmovieclip to the buttons across the bottom.
I have not had success with launching from the initial 7 buttons. I can place the background, but haven't been able to call the correct MC.
Make sense? Can anybody help?
.attachMovieClip Function
Heeeeeeeeeeelp!!!
My problem is this...
I have an .swf file in an html doc which has navigation buttons on it. I am loading a movie using the onPress which brings in a small transluscent box called("eventsthings") that I want to attach a movie clip to called "calendar" that resides in the same library as the swf "eventsthings".
The window pops up on press and is able to be dragged, reduced and trashed, works fine, however I am unable to bring the attachMovie in and place it on the stage of ("eventsthings") which is on level 3. Here is the code I am placing in the 10th frame of the movie "Eventsthings". The stop is because I have the movie "eventsthings" Tweening in from 0 opacity to larger 100% opacity. It stops on frame number 10 which has the following code in it. Can anyone tell me why it won't attach the movie which I have named event-cal under the linkage. Appreciate all your help
thanks
John
//Stop the tween when the eventsthings.swf opens.
stop ();
//attach to the movie clip instance name "event-win" the //following movie. "event-cal on level 35
_root.event-win.attachMovie( event-cal,event-cal, 35 );
[Edited by jsm-inc on 08-23-2002 at 12:24 AM]
AttachMovieClip...[init Obj] ?
okay what i want to do is attach this mc and with it the code onRelease=closeWin; closeWin is a function. how can i do this using the init obj part of attach mc? ive seen it done like attachMC(...{onEnterFrame:function}); but i cant get it to work. thanks for your help!
Which Is Better...attachMovieClip ...or GoToAndPlay?
I am making a series of Flash movies that displays MCs telling about the area that the cursor rolls over. I have found 2 ways to "skin this cat". One is to use goToAndPlay and it goes to the area of the timeline and plays the timeline with the same basic layout with the new graphics in place. An example would be to have the cursor roll over a photo detail and an enlarged photo of the detail(with caption) would appear on the stage. In frame(1) I would have the photo...in frame 15-25 I'd have the same photo but a graphic of the enlargement would fade in. When the curson rolls out of the area the timeline is directed back to Frame(1). I hope all this talk will make my intentions more clear.
The alternative is to use attachMovieClip and basically do the whole thing with actionscript. Thanks to lukesquall I know how to do this.
My question is...are there any advantages either way? Or just two ways of doing the same task?
AttachMovieClip Not Showing Up
Hi I need a pair of fresh eyes...
Are there some devastating errors in this code...
the "celle" MC has properties and linkage identifier selectet..
nothing shows up??
Code:
start_x = -10;
start_y = 0;
skemaVars = new LoadVars();
skemaVars.load("data.txt");
skemaVars.onLoad = function(success) {
if (success) {
datoer = this.datoer.split(",");
size = datoer.length;
for (j=0; j<=size; j++) {
this.attachMovie("celle", "celle"+j, j+1);
this["celle"+j]._y = this["celle"+j]._height*0.8*j;
}
} else {
trace("Det bare noget lort!");
}
};
stop();
AttachMovieClip + _xscale
Problem:
My mc is attached dynamically using attachMovieClip.
I want to flip the mc using:
_xscale *= -1;
I can't! It flips excactly once and then returns to _xscale = 100; Although I can add to _xscale's value using:
_xscale += 50;
I suspect that it has to do with attaching the mc dynamically since this code works nicely with non-attached mc's.
Code:
if(this.flipVar == true){
this._xscale *= 0.8;
if(this._xscale < 1){
_xscale *= -1;
this.flipVar = false;
}
}
if(this.flipVar == false){
this._xscale /= 0.8;
if(this._width >= this.flipWidth){
this.flipVar = true;
}
}
Does anyone know how to work around this? Even when I place the _xscale *= -1 in onEnterFrame=function() it only flips once and then returns to _xscale = 100 again... When it should flip back and forth on every frame???
AttachMovieClip With Loop
attachMc with loop - now w/ diagram!
For some reason im stuck on this. so i have deleted some of the code to clean it up. I was trying this with no luck:
mc = orgin.attachMovie('mc', 'mc'+i, this.getNextHighestDepth());
I need to attch movie clips to an 'orgin' movie. Im attaching them via a loop like this:
// Place the clip on the stage later to become a member of the activator class
function placeClip() {
// Here im creating the orgin clip that needs to allow the 'mcs' to be attach to it
_root. createEmptyMovieClip('orgin',getNextHighestDepth()
);
// Loop to create fan
for (var i = 0; i<120; i++) {
// Attach the movie clips
mc = attachMovie('mc', 'mc'+i, this.getNextHighestDepth());
// Set degree of each clip
mc._rotation += i*3;
// Have the clip become a member of the activaotr Class
mc.activator();
}
}
Also please see the diagram, although i dont think its really nessessary.
Thanks for the help!
[F8] AttachMovieClip Duplicating Odd
Attempting to make a simple flame effect that follows the mouse. Well that works, except it's duplicating the flame again in an odd fashion and I can't for the life of me work out why! Any help much appreciated.
On the first (and only) _root frame.
PHP Code:
i = 1;
onMouseMove = function () {
decalpos = {_x:_root._xmouse, _y:_root._ymouse};
};
onEnterFrame = function () {
var flame = _root.attachMovie("flame_mc", "flame_mc", i, decalpos);
i++;
};
On the flame symbol (on the first and only frame)
PHP Code:
this._x -= random(5);
this._x += random(5);
this._y -= random(2);
this.onEnterFrame = function() {
this._y -= 5;
this._alpha -= 1;
this._xscale -= 4;
this._yscale -= 4;
if (this._alpha<=20) {
trace("removed");
this.removeMovieClip();
}
};
.fla attached
AttachMovieClip Problems
What is wrong with the code below? I managed to do this before but somehow I can't do it again. I have a MC in the library called rocket, it is also linked for actionscript with rocket as identifier.
Code:
var oMouseListener:Object = new Object();
oMouseListener.onMouseDown = function():Void
{
trace ( "mouseClick detected" );
this.attachMovie( "rocket", "newRocket", getNextHighestDepth );
}
Mouse.addListener(oMouseListener);
BTW Am I alone in thinking that adding the datatypes (like Object();, function() etc is only taking away from readability? I don't see any advantages to this...
Preloader For AttachMovieClip
Hi,
Does anyone know how to actionscript a preloader to use on a movieclip that is attached using attachMovieClp and that loads in jpegs dynamically?
Many thanks
|