Multiple Fading Grids In One Swf?
Hi guys,
Perhaps you can help. It's sure to be a really simple problem but I can't see where, or how to solve it.
I need to have a series of images appear in a base FLA. The way I thought I could do it was with the Fading Grid script from the tutorials here.
I've got individual Fading Grid movies working without a problem, but when I load them into a single file one works and the other doesn't.
All the instance names are specific and it seems that when the timeline stops at the frame with all the AS one is working and the other not.
I've put three files into a folder. The individual movies and a tester FLA with the two movies in it. You can get them here!
Can anyone help please. I'd be forever grateful. Thanks.
KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 01-17-2006, 01:32 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Fading Grids
here's an effect i made that is to do with fading grids - hopefully this will help someone. i know there's a lot of people wondering how to code this.
i made the code very easy to adapt for yourself to use so please enjoy here is a basic example of one:
[swf=http://www.kirupa.com/forum/attachment.php?attachmentid=8410&stc=1]height= 600 width=400[/swf]
here's some replacement functions. they're the first ones that i made. not nearly as nice, but you can have a look:
ActionScript Code:
MovieClip.prototype.createGrid = function(x1:Number, x2:Number, y1:Number, y2:Number) { x = x1; y = y1; _root.handle.onEnterFrame = function() { tile = _root.attachMovie("tile", "tile_"+x+"_"+y, objCount); objCount++; tile._x = x*width; tile._y = y*height; tile._alpha = 0; tile.fadeIn(); // x++; if (x>x2) { x = x1; y++; if (y>y2) { delete _root.handle.onEnterFrame; doneAction(); } } };};MovieClip.prototype.destroyGrid = function(x1:Number, x2:Number, y1:Number, y2:Number) { x = x2; y = y2; _root.handle.onEnterFrame = function() { tile = _root["tile_"+x+"_"+y]; tile.fadeOut(); x--; if (x<x1) { x = x2; y--; if (y<y1) { delete _root.handle.onEnterFrame; doneAction(); } } };};
Fading Grids
here's an effect i made that is to do with fading grids - hopefully this will help someone. i know there's a lot of people wondering how to code this.
i made the code very easy to adapt for yourself to use so please enjoy here is a basic example of one:
[swf=http://www.kirupa.com/forum/attachment.php?attachmentid=8410&stc=1]height= 600 width=400[/swf]
here's some replacement functions. they're the first ones that i made. not nearly as nice, but you can have a look:
ActionScript Code:
MovieClip.prototype.createGrid = function(x1:Number, x2:Number, y1:Number, y2:Number) { x = x1; y = y1; _root.handle.onEnterFrame = function() { tile = _root.attachMovie("tile", "tile_"+x+"_"+y, objCount); objCount++; tile._x = x*width; tile._y = y*height; tile._alpha = 0; tile.fadeIn(); // x++; if (x>x2) { x = x1; y++; if (y>y2) { delete _root.handle.onEnterFrame; doneAction(); } } };};MovieClip.prototype.destroyGrid = function(x1:Number, x2:Number, y1:Number, y2:Number) { x = x2; y = y2; _root.handle.onEnterFrame = function() { tile = _root["tile_"+x+"_"+y]; tile.fadeOut(); x--; if (x<x1) { x = x2; y--; if (y<y1) { delete _root.handle.onEnterFrame; doneAction(); } } };};
Dynamic Fading Grids
Hi
I was hoping someone could help me with dynamic loading movies.
Now, I've done the tutorial on this website about dynamic movies and added it to my website. The movies loaded static images and everything worked fine.
But then I did the tutorial involving fading grids and images. That movie works fine in itself but once I try to load it dynamically into another movie a white box is all that loads.
I thought maybe the movie was loading but not playing but I tried calling GOTOANDPLAY and PLAY and even NEXTFRAME but none of them worked.
I used the DEBUG MOVIE feature in Flash MX and using breakpoints the fading grid kind of flashes on the screen and then disappears.
I was hoping someone had some ideas. I'd be grateful, thanks.
RabBell.
Dynamic Fading Grids
Hi
I was hoping someone could help me with dynamic loading movies.
Now, I've done the tutorial on this website about dynamic movies and added it to my website. The movies loaded static images and everything worked fine.
But then I did the tutorial involving fading grids and images. That movie works fine in itself but once I try to load it dynamically into another movie a white box is all that loads.
I thought maybe the movie was loading but not playing but I tried calling GOTOANDPLAY and PLAY and even NEXTFRAME but none of them worked.
I used the DEBUG MOVIE feature in Flash MX and using breakpoints the fading grid kind of flashes on the screen and then disappears.
I was hoping someone had some ideas. I'd be grateful, thanks.
RabBell.
Fading In And Fading Out With Multiple Photos
Can someone please tell me how I can do a fade in fade out on photos? I am wanting to have about 6 photos and each photo is suppose to fade into another. I have searched Google for this but got nowhere. Thanks in advance.
Help Fading Multiple Mc's
Hi all
Tearing my hair out here!
Basically I have 6 mc's, when each is hovered I need the other mc's to fade to 30% alpha. I also have a text box which fades in and has button-specific text inserted on hover.
The actionscript I'm using is on a separate mc over the images and it only works if you have 1, if I duplicate it, it stops working properly:
onClipEvent (enterFrame) {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
setProperty ("_root.mc2", _alpha, "30");
setProperty ("_root.mc3", _alpha, "30");
setProperty ("_root.mc4", _alpha, "30");
setProperty ("_root.mc5", _alpha, "30");
setProperty ("_root.mc6", _alpha, "30");
_root.textbox.nextFrame();
_root.textbox.textholder.header = "...banks"
_root.textbox.textholder.body = "Gunnebo Banking are responsible for Gunnebo Banking are responsible for Gunnebo Banking are responsible for Gunnebo Banking are responsible for Gunnebo Banking are responsible for Gunnebo Banking are responsible for Gunnebo Banking are responsible for Gunnebo Banking are responsible for "
} else {
_root.textbox.prevFrame();
setProperty ("_root.mc2", _alpha, "100");
setProperty ("_root.mc3", _alpha, "100");
setProperty ("_root.mc4", _alpha, "100");
setProperty ("_root.mc5", _alpha, "100");
setProperty ("_root.mc6", _alpha, "100");
}
}
but there must be another way!!! HELP!
I'd like the others to fade as opposed to jump to the 30% alpha too, so if you can do that, awesome!
FLA file attached, hope you can help!
Thanks in advance people
SPRITE
Multiple Images Fading, One Into The Next
I'm trying to find a tutorial somewhere to show how this can be done scripting, but I can't find anything anywhere.
I assume I use the Tween class, but I haven't mastered using that yet. I'm sure this is a cakewalk to everyone here, but could someone point me to a few simple instructions?
Fading Multiple MovieClips
What I'm looking to do is have one button fade in/out fadeBox1_mc
and the other button fade in/out fadeBox2_mc.
I can get one button to fade in and out the graphic with the following code:
Main Timeline
stop();
fadeBox1_mc.onEnterFrame = function() {
if (fade) {
fadeBox1_mc.nextFrame();
} else {
fadeBox1_mc.prevFrame();
}
};
Button:
on (rollOver){
this.fade=true;
}
on (rollOut,dragOut){
this.fade=false;
}
However when I attempt to create another button and make it fade in/out fadeBox2_mc i'm unsuccessfull when adding another fade function with fadeBox2_mc to the main timeline. What would be the most efficient way have having multiple buttons control _mc fades? Thanks a ton!
Multiple Sounds Fading In And Out
hi! I'm trying to work out how I can use a function over again to fade in and out different sounds, sometimes overlapping, so that as one sound is fading out another begins to fade in. I have done the following so that I can call the fades at any time along the timeline:
// initiate sound
music = new Sound();
music.attachSound("solitaire");
music.start(0, 999999);
// set the volume of the sound to zero
music.setVolume(0);
// set a variable named 'vol'
vol = 0;
function callFadeIn() {
inFade = setInterval(fadeIn, 50);
}
function fadeIn() {
// fade the sound in with an increment of 3 in the variable 'vol'
vol += 3;
music.setVolume(vol);
// put an if condition to restrict the increment in volume after it reaches to 100
if (vol>=100) {
clearInterval(inFade);
}
}
function callFadeOut() {
outFade = setInterval(fadeOut, 50);
}
function fadeOut() {
// fade the sound in with an increment of 3 in the variable 'vol'
vol -= 3;
music.setVolume(vol);
// put an if condition to restrict the increment in volume after it reaches to 100
if (vol<=0) {
clearInterval(outFade);
}
}
callFadeIn();
on frame 200 I stop(); and callFadeOut();
two things, how do I pass arguements across the two functions?? and of course will I need to create these sounds in Mcs??
Multiple Sounds Fading-in And Out At Different Moments
Hello people.
Ok, my problem:
I have an animation where I use 5 different MP3 files, small cuts, which are "called" at different moments along the presentation.
Now, calling the cuts is more or less the easy part, the scientific part is the ending, or better, the fading-out of the cuts at a specific moment, at a specific speed (duration), no matter at which speed the animation is, that way all the cuts will fade-in and fade-out correctly in any computer.
I want to load (fade-in) each cut whenever I want, and also fade it out whenever I want.
Any advise you can give me?
Thank you very much.
Multiple Movieclips Fading And Unfading.
Hey, I have 36 instances of one movieclip (called panel1, panel2...panel36) that I want to fade and unfade depending on whether the mouse has rolled over that one instance, I tried this code, which works when there is only one instance, but not when multiple.
ActionScript Code:
_root.onEnterFrame = function () { for (i = 0; i < 36; i++) { name = "panel"+i; if (rollover) { if (_root[name]._alpha > 0) { _root[name]._alpha -= 10; } } if (rollout) { if (_root[name]._alpha < 100) { _root[name]._alpha +=10; } } } _root[name].onRollOver = function () { rollover = true; rollout = false; } _root[name].onRollOut = function () { rollout = true; rollover = false; }}
Does anyone have any ideas on why it isn't working and how to make it work?
Thanks in advance, Sammo
rollover+out.fla (MX)
Multiple Movieclips Fading And Unfading.
Hey, I have 36 instances of one movieclip (called panel1, panel2...panel36) that I want to fade and unfade depending on whether the mouse has rolled over that one instance, I tried this code, which works when there is only one instance, but not when multiple.
ActionScript Code:
_root.onEnterFrame = function () { for (i = 0; i < 36; i++) { name = "panel"+i; if (rollover) { if (_root[name]._alpha > 0) { _root[name]._alpha -= 10; } } if (rollout) { if (_root[name]._alpha < 100) { _root[name]._alpha +=10; } } } _root[name].onRollOver = function () { rollover = true; rollout = false; } _root[name].onRollOut = function () { rollout = true; rollover = false; }}
Does anyone have any ideas on why it isn't working and how to make it work?
Thanks in advance, Sammo
rollover+out.fla (MX)
Fading Multiple Images Via Alpha And Tween
hi, im trying to fade two separate images on the same layer from 0 alpha to 100 alpha but flash MX 2k4 will not do it! It works fine if i do the same process with just one image, but not with any more on the same layer.
do i have to do a separate layer for every image i want to fade? Whats the solution to this problem? I have tried grouping them and this does not work either.
I am using the pictures as graphic symbols, and as i say if its just one image that i change the alpha on per layer it works fine (i.e 5 images on one layer, as long as i only tween the alpha on one it works fine, if i try and tween the alpha on any more, grouped or ungrouped it does not work, it just stays at 0 alpha over the tween and even into the next keyframe)
thanks guys!
Voetsjoeba's Fading Grid Multiple Images
So I followed Voetsjoeba's wonderful fading grid tutorial. What I want to do next is add multiple images in the "image" mc on different frames, and then have the main actionscript go through them one by one. So I thought....
ActionScript Code:
for (var p = 1; p<4; p++) { _root.image.gotoAndStop("p") fadeOut(0, 10);}
..but as I should have guessed I was doing something wrong. P is the frame label "1" "2" etc.
I'll link the fla if needed, but its a bit big and I didn't want to push that on some unsuspecting viewers.
Thanks.
Voetsjoeba's Fading Grid Multiple Images
So I followed Voetsjoeba's wonderful fading grid tutorial. What I want to do next is add multiple images in the "image" mc on different frames, and then have the main actionscript go through them one by one. So I thought....
ActionScript Code:
for (var p = 1; p<4; p++) { _root.image.gotoAndStop("p") fadeOut(0, 10);}
..but as I should have guessed I was doing something wrong. P is the frame label "1" "2" etc.
I'll link the fla if needed, but its a bit big and I didn't want to push that on some unsuspecting viewers.
Thanks.
Tween Class Fading Loop, Acting Up With Multiple Clicks
Hello all,
I have a thumbnail gallery that I am working on. The gallery works fine and when you click the thumbnails it loads the respective swf into the container.picture movieclip.
I have used the tween class to fade a set of clips in a single swf in a loop infinitely.
The problem lies in that when you click the thumbnail, the swf loads fine and everything plays great (THE FIRST TIME) then if you repeatedly click the same thumbnail the tween class acts up and the fading gets strange, the timing messed up and it starts to almost layer the clicks on each other.
The problem seems VERY similar to when you use a setInterval and don't clear the interval and it starts to overlay them upon multiple clicks.
Is there a way to clear the tween class, delete it at run time, etc? This problem is driving me up the wall.
I have provided my code below (just for the tween class, not for the navigation) to hopefully spark an idea.
Thanks!
Neil
Attach Code
import mx.transitions.Tween;
import mx.transitions.easing.*;
//array that pulls in all movieclips and turns to array
var mcArray:Array = new Array(content1, content2);
for (var k in mcArray) {
mcArray[k]._alpha = 0;
}
var n:Number = 0;
function playFades() {
if (n<mcArray.length) {
var tween_handler1:Object = new Tween(mcArray[n], "_alpha", Strong.easeIn, 0, 100, 1, true);
tween_handler1.onMotionFinished = function() {
//trace("motion finished by "+mcArray[n]);
//n++;
var tween_handler2:Object = new Tween(mcArray[n], "_alpha", Strong.easeIn, 100, 0, 3.5, true);
tween_handler2.onMotionFinished = function() {
//trace("motion finished by "+mcArray[n]);
n++;
playFades();
};
};
} else {
n = 0;
playFades();
}
}
playFades();
Edited: 02/19/2007 at 10:46:10 AM by Visionology
Grids.
I've seen lotsa grid backgrounds around. Simple question really. How do i make grids? Theres bound to be a simpler way than using lines and lines and more lines in flash? Photoshop? Any help? thanks
Grids?
When using the grid in flash mx 2004, is there no way to set the grid so it appears above all?
When i use a grid it shows up, however when i draw a rectangle or something the grid dissapears under it. I would like to be able to see the grid all the time, as if it is an image layed over the actual flash.
How can i do this?
More Fun With Grids.
Last thread I had made, I was getting help with a grid I had created out of one Movie Clip.
Now I've been experimenting with creating a grid, but using several Movie Clips.
I have four colored tiles, and would like to generate a 5x5 grid (to start) with said tiles, placed at random.
I've done some research, and here's the code I have so far.
Code:
var myArray:Array = new Array();
var totalRows:Number = 5;
var totalColumns:Number = 5;
var spacing:Number = 5;
var red:Red = new Red();
var blue:Blue = new Blue();
var green:Green = new Green();
var yellow:Yellow = new Yellow();
var Grid:Array = [green, red, blue, yellow];
for (var row:Number = 0; row < totalRows; row++) {
if (myArray.length-1 < row) {
myArray.push([]);
}
for (var column:Number = 0; column < totalColumns; column++) {
var randomColor:Number = Math.round(Math.random()*(Grid.length-1));
var colorMC:MovieClip = Grid[randomColor];
addChild(colorMC);
colorMC.x = row * colorMC.width+spacing;
colorMC.y = column * colorMC.height+spacing;
myArray[row].push(colorMC);
}
}
for (var i:Number = 0; i < myArray.length; i++) {
for (var j:Number = 0; j < myArray[i].length; j++) {
trace(myArray[i][j]);
}
}
Right now, as you can probably tell (better than I can) from the code, when it runs, the program only creates one box of each color and places it randomly. Anyone have any pointers?
Grids
EDIT: Grid Handling code. Thanks for the help guys, !!
CODE AFTER AWESOME CHANGES
ActionScript Code:
package Grid{ import flash.display.*; import flash.display.BitmapData; import flash.utils.*; import flash.geom.*; import flash.text.*; public class Grid{ public function Grid(Size:int, Dist:int, Style:String, scene:Sprite){ m_Grid = new BitmapData(550, 400, true, 0xffffffff); m_GridBmp = new Bitmap(m_Grid); scene.addChild(m_GridBmp); GridSize = Size; GridDist = Dist; DrawGrid(); } public function DrawGrid():void{ for (var i:int = 0; i < GridSize; i++){ for (var j:int = 0; j < GridSize; j++){ m_Grid.setPixel(i*GridDist, j*GridDist,0); } } } static public function CheckGrid(X:int, Y:int):Point{ var A:int = Math.floor(X/GridDist); var B:int = Math.floor(Y/GridDist); X >= ((A*GridDist)+(GridDist/2)) ? X = (A+1)*GridDist : X = A*GridDist; Y >= ((B*GridDist)+(GridDist/2)) ? Y = (B+1)*GridDist : Y = B*GridDist; return new Point(X,Y); } // Member Variables static public var GridSize:int; static public var GridDist:int; static public var GridStyle:Array; public var m_Grid:BitmapData; public var m_GridBmp:Bitmap; }}
Constructor is used via,
var m_Grid:Grid = new Grid(100, 10, "Line", m_Scene);
Where m_Scene is the parent scene or stage to attach to.
GridStyle is unused in this example, but is intended for styles, ie: dotted lines, solid lines, multicolored, dots etc.
CheckGrid function handles snapping. It takes two ints, X and Y (can be a point) and returns a Point.
Draw Grid Should only happen once. And the grid class should be instantiated and attached prior to other screen elements.
Anyone is allowed to use this for any purposes.
The input provided to create this class is very appreciated.
mechanicaltimi
Grids?
When using the grid in flash mx 2004, is there no way to set the grid so it appears above all?
When i use a grid it shows up, however when i draw a rectangle or something the grid dissapears under it. I would like to be able to see the grid all the time, as if it is an image layed over the actual flash.
How can i do this?
Grids
Ok, I would like to have a custom grid size that i can snap to in both Flash MX and Photoshop 7. I know there are already girds there but iI would like a custom sized one lie 10px by 10px if possible. Any ideas?
Array Of Grids
I cannot find something that explains how I could make a set of grids or tiles with actionscript. This grid would be say 10 colums wide and three rows deep. I would also think that this could be done in polar form. I anyone has any ideas, Please let me know.
Creating Grids
I'm trying to figure out how can I attach a group of MC and form them into a grid.
The origin point for the MC are the top left corner not center. This is so I can load an image into them.
Code:
function thumGrid(numThumb) {
for (var i = 0; i < numThumb; i++) {
thumb = archiveContainer.attachMovie("thumbnail", "t"+i, i);
}
}
numThump was going to be the number of thumbnails that needed to be generated.
I wanted to place them all in a grid 3 wide.
How can I do this.
Thanks
Question About Grids
Ok..so I pretty much understand the code for making a grid, thanks to the tutorial of course. What I'm wondering and seeking is a way to duplicate each dot in the grid one after another, rather then all at once. I was wondering if it would possible to also control the speed at which they are created. Anyways if any could help me that would be great. Just so you dont have to look for the code for the grid its:
ActionScript Code:
gridx=30; gridy=30; num=0; for (var i=0;i < 10;i++) { __for (var j=0;j < 10;j++) __{ ____dot.duplicateMovieClip("dot"+num,num); ____mc=this["dot"+num]; ____mc._x=gridx*i; ____mc._y=gridy*j; ____num++; __} } dot._visible=0;
Thanks alot.
Kyle
Grids With For Loops
Hello all,
Pretty basic stuff this, but I'm not sure why it isn't working.
I have a movie clip in library which I want to attach to the stage multiple times to form a perfect grid. I am using th following code but it is only laying the movieclips out on the x axis:
for (var y:Number = 0; y< 100; y = y + 10){
for(var x:Number = 0; x < 100; x = x + 10){
this.attachMovie("mc_circle", "mc_circle" + x, x,{_x, _y:y});
}
}
Any ideas why this isn''t working?
thanks
Question About Grids
Ok..so I pretty much understand the code for making a grid, thanks to the tutorial of course. What I'm wondering and seeking is a way to duplicate each dot in the grid one after another, rather then all at once. I was wondering if it would possible to also control the speed at which they are created. Anyways if any could help me that would be great. Just so you dont have to look for the code for the grid its:
ActionScript Code:
gridx=30; gridy=30; num=0; for (var i=0;i < 10;i++) { __for (var j=0;j < 10;j++) __{ ____dot.duplicateMovieClip("dot"+num,num); ____mc=this["dot"+num]; ____mc._x=gridx*i; ____mc._y=gridy*j; ____num++; __} } dot._visible=0;
Thanks alot.
Kyle
Displaying Array Grids
I'm using Flash 5, and have run into a problem with regards to arrays.
The program requires three variables from the user (X,Y,Z).
I want Flash to create and display a grid for me, the grid should be X long by Y high, and should display a random number from 1 to Z.
I've sorted out the random number generation, and how to assign the numbers to X. I've then told flash to repeat this process until Y is completed.
How do I now get flash to display this grid in a text box, and will the code below work?
The code I've used so far is below, and may contain errors that need fixing:
//Generates an array 1 to X containing a randomnumber between 1 and Z
function randomnumber () {
countx = 1;
generatenumber= new Array(X);
do {
generatenumber[countx] = (random(Number(Z)))+1;
countx = countx +1;
} while (countx <= X);
}
//Generates an array 1 to Y which should contain the values from 1 to X
countz = 1;
generaterows= new Array(Y);
do {
generaterows[countz]=(randomnumber);
countz = countz +1;
} while (countz <= Y);
Thanks for your help.
Row Selection In Data Grids
hey, I'm back with another question pertaining to dataGrids... I was wondering if there is a way to set a selected row or item with actionscript. There doesn't appear to be a "setSelected()" or anything in the documentation.
thanks a bunch for any help you can give me
[F8] Highlighting Selected Grids
Example:
http://olar.getkilled.net/pub/battle.html
(Move button is the left facing arrow)
Hey guys, got a question.
I have this grid that is dynamically drawn. 17x8 all 32px a piece.
I have them all assigned instance names ie cell1 cell2 etc as the loop goes on.
Now, I have a function that highlights the cells around the player when the move button is clicked:
code:
function moveSelect(num) {
//'num' is the variable _root.playerMovement which determines how many
//cells a player can move per turn
//thus the amount of cells in each direction that need to be highlighted
//indicating the player is able to move there
//Toggle highlight on/off
if (_root.moveTiles != "on") {
_root.moveTiles = "on";
vis = true;
}else {
(_root.moveTiles == "off");
_root.moveTiles = "off";
vis = false;
}
///
i = new Number(1);
factorY = new Number(17);
factorX = new Number(1);
//While the increment is less than or equal to the player's movement speed
//moveTile is a blue square movieclip attached to each duplicated cell.
//their initial visible value is false.
while (i <= num) {
//_root.playerLoc is the variable containing the current cell the player is over
set("_root.battleMap.cell"+(_root.playerLoc+factor Y)+".moveTile._visible",vis);
set("_root.battleMap.cell"+(_root.playerLoc-factorY)+".moveTile._visible",vis);
set("_root.battleMap.cell"+(_root.playerLoc+factor X)+".moveTile._visible",vis);
set("_root.battleMap.cell"+(_root.playerLoc-factorX)+".moveTile._visible",vis);
i++;
factorY += 17;
factorX += 1;
}
}
And, a function that actually moves the player when one of the highlighted cells is clicked:
code:
XMLSocket.prototype.onData = function(msg) {
msg = msg.split(",,");
char = msg[0];
player_id = msg[1];
cmd = msg[2];
grid = msg[3];
battle_id = msg[4];
//Ensure the data is for this battle
if (battle_id = _root.battleID) {
if(cmd == "Join" and char != _root.player) {
myLv.load("http://localhost/dun/battleFlash.php");
}else if (cmd == "Move") {
//Move function...
set("_root.player"+player_id+"Tile._x", eval("_root.battleMap.cell"+grid+"._x")+16);
set("_root.player"+player_id+"Tile._y", eval("_root.battleMap.cell"+grid+"._y")+16);
moveSelect(_root.playerMovement);
_root.playerLoc = grid;
trace(playerLoc);
}
}
}
Ok, so, when the swf is loaded, you can move easily by pressing the move button, and selecting on of your highlighted cells. When you try to move again, the cells do not highlight correctly, even though they should, in theory.
No, I'm no mathematician so any help someone could give me on this junk script I have managed to shoot from my butt would be most appreciated.
I'll put up a page so you can see what I'm up against and test it out.
P.S. I understand about the wrapping around on the x axis, but sometimes some wierd type of wrapping comes about on the y axis too.. I don't get it -_-
Example:
http://olar.getkilled.net/pub/battle.html
(Move button is the left facing arrow)
Now, I've helped out a lot on this place, time to get some back I hope!
Grids Overlap A Line
Hey
If have a line that is shot from my guy. The angle, distance and start and end points are known. I have again, a 30x30 grid. Is it possible to find out which grid spaces the line crosses? E.g. a line from 0,0 to 0,90 will cross grid spaces 0,0 0,1 0,2. Its obviously easy in this example just Math.floor() the numbers but when it is at an angle is gets much more complexe.
Thanks for any help I get!
Dan0
Creating Grids In Flash 8
Hi All,
I used the following code from Kirupa's site to create grids in flash:
gridx=30;
gridy=30;
num=0;
for (var i=0;i < 10;i++)
{
for (var j=0;j < 10;j++)
{
dot.duplicateMovieClip("px"+num,num);
mc=this["px"+num];
mc._x=gridx*i;
mc._y=gridy*j;
num++;
}
}
dot._visible=0;
However,it does not seem to work in Flash 8.I created a movie clip and named it px.
Kindly advise me on this.I am a starter in Flash.
Lines, Grids And Trig...oh My
Hi i need some help snaping my line to every 20 px and I would like to be able to add a measure ment to each line... anyone know how this is done. any help or sugestions would be greatly appreciated!!
Thanks
PHP Code:
i = 0; MovieClip.prototype.buildPoint = function(halfWidth) { this.lineStyle(1, 0x000000, 200); this.beginFill(0xE6E6E6, 100); this.moveTo(-halfWidth, -halfWidth); this.lineTo(halfWidth, -halfWidth); this.lineTo(halfWidth, halfWidth); this.lineTo(-halfWidth, halfWidth); this.lineTo(-halfWidth, -halfWidth); }; function drawProcess() { this.createEmptyMovieClip("line" + _parent.current_line, this.getNextHighestDepth()); i++; xPos = _xmouse; yPos = _ymouse; point1._x = point2._x=xPos; point1._y = point2._y=yPos; point1._visible = point2._visible=true; this["line" + _parent.current_line].moveTo(xPos, yPos); this.onMouseMove = function() { tempLine.clear(); tempLine.lineStyle(2, 0xE6E6E6, 50); tempLine.moveTo(xPos, yPos); //if (Key.isDown(Key.SHIFT)) { //trace(_xmouse + ' ' + _ymouse + ' ' + this._x + ' ' + this._y); //if (_xmouse >= 200 || _ymouse >= 200) //{ if (_ymouse<=yPos-10 || _ymouse>=yPos+10) { point2._x = xPos; point2._y = _ymouse; tempLine.lineTo(xPos, _ymouse); } else { point2._x = _xmouse; point2._y = yPos; tempLine.lineTo(_xmouse, yPos); } //} //} else { //point2._x = _xmouse; // point2._y = _ymouse; // tempLine.lineTo(_xmouse, _ymouse); //} }; } function drawFinalLine() { tempLine.clear(); delete this.onMouseMove; if (_xmouse > 0 && _ymouse > 0) { point1._visible = point2._visible=false; this["line" + _parent.current_line].lineStyle(2, 0x000000, 100); //if (Key.isDown(Key.SHIFT)) { if (_ymouse<=yPos-10 || _ymouse>=yPos+10) { this["line" + _parent.current_line].lineTo(xPos, _ymouse); } else { this["line" + _parent.current_line].lineTo(_xmouse, yPos); } //} else { //line.lineTo(_xmouse, _ymouse); //} if (i>=4) { i = 0; } trace ("line" + _parent.current_line) _parent.current_line++; }} /*function clearMe() { if (Key.isDown(Key.DELETEKEY)) { this.line.clear(); } _root.undo_btn.onPress = function() { _root.["line" + current_line].removeMovieClip(); current_line--;} */this.createEmptyMovieClip("tempLine", 2); this.createEmptyMovieClip("point1", 3).buildPoint(3); this.createEmptyMovieClip("point2", 4).buildPoint(3); point1._visible = point2._visible=false; this.onMouseDown = drawProcess; this.onMouseUp = drawFinalLine; this.onEnterFrame = clearMe;
Creating Empty MC And Grids
Code:
_root.createEmptyMovieClip('dot', 1)
dot.lineStyle(.5,000000,100)
dot.beginFill(778833,100)
dot.lineTo(15,0)
dot.lineTo(15,15)
dot.lineTo(0,15)
dot.lineTo(0,0)
dot.endFill()
gridX=30;
gridY=30;
nNum=0;
for (var ii=0;ii < 10;ii++) {
for (var jj=0;jj < 10;jj++) {
dot.duplicateMovieClip("dot"+nNum,nNum);
mc=_root["dot"+nNum];
mc._x=gridX*ii;
mc._y=gridY*jj;
nNum++;
}
}
This just creates a movieclip that is a square, but when I try to duplicate it, it doesn't work. The Original MC is on the stage, but the grid doesn't show up, also, the statement
dot._visible = 0
Doesn't work, but
dot._alpha = 0
does work...I'm confuzzled...any ideas?
Moving Items Between 2 Grids
I want to move items between 2 datagrids.
If I click on the Add Button it should move the data from GridA to GridB
GridA is declared as the dataprovider...
How do I do it?
Loading Random Square Grids - As 2.0
Hi all,
I'm assigned to do the portfolio section for my company's website and my supervisor has specifically told me what he wanted in terms of navigation and layout. Basically, he wants each portfolio piece to be square and in the form of 7 x 7 square grids. Each square's dimension is 100x100 px. He wants each portfolio piece to load randomly every time the page loads, so that it makes a shape of jigsaw puzzle-like if the piece is less than 49. Each image needs to be imported externally so that when we have more portfolio, we can simply added it to the array. Each portfolio piece should behave like a button that links to a bigger image.
I was able to get it to the point where the squares are generated dynamically on 7x7 square grids ( I used script from "Flash Hacks" book by Sham Bingal) Now I'm trying to develop the script to get it to work like my supervisor wanted. Can someone help me modify the script or at least give some hints on how to execute this.
Here is a link to download the fla file:
http://www.bionicrab.com/portfolio_test.fla
Thanks a bunch
Buddy
Loading Random Square Grids
Hi all,
I'm assigned to do the portfolio section for my company's website and my supervisor has specifically told me what he wanted in terms of navigation and layout. Basically, he wants each portfolio piece to be square and in the form of 7 x 7 square grids. Each square's dimension is 100x100 px. He wants each portfolio piece to load randomly every time the page loads, so that it makes a shape of jigsaw puzzle-like if the piece is less than 49. Each image needs to be imported externally so that when we have more portfolio, we can simply added it to the array. Each portfolio piece should behave like a button that links to a bigger image.
I was able to get it to the point where the squares are generated dynamically on 7x7 square grids ( I used script from "Flash Hacks" book by Sham Bingal) Now I'm trying to develop the script to get it to work like my supervisor wanted. Can someone help me modify the script or at least give some hints on how to execute this.
Here is a link to download the fla file:
http://www.bionicrab.com/portfolio_test.fla
Thanks a bunch
Buddy
Xml Portfolio Grids (The Never Ending Story)
Hey,
i am searching for weeks/month now on how to build xml portfolio grids (galleries). They are used on so much websites but there is no really good documentation on it what techniques i need to build my own.
Example sites that makes use of such grids i would like to learn how to build.
http://www.onurcancoban.com
http://www.onlysamo.com/
http://www.flashden.net/files/39054/index.html
i would like to understand the following things
a) How to load thumbs through the xml and load every single content type (image/swf/video) to a MovieClip
b) Duplicate this MovieClip and position it on the stage in a grid
c) Give custom transition/s to the hole gallery or single MovieClip
d) Linking the content to the "full content" and tween it for e.g to the center of the stage with custom transition and dynamic resizing the content to it´s width/height
c) Previous/Forward functionality to walk through the grid
Maybe one of you could help leading me through the hole process of creating such a xml gallery grid so i get to know the basics and can customize things on my own.
Thanks so much for help
Movieclip Loading Image On X And Y Grids
I am creating an MC for each image I have in a folder. I create an empty MC then I load the image in the MC. the problem is when I create an 2 MCs with the same '_x' value, the older MC becomes invisible and the new MC becomes visible.
here is my code anyway...
var i = 4;
var y = 50;
do {
i++;
var x = x + 90;
_root.createEmptyMovieClip("clip"+i,x);
_root["clip"+i].createEmptyMovieClip("imageHolder_mc", this.getNextHighestDepth());
if (x >= 900) {
x = 90;
y = y + 60;
}
trace(x);
_root["clip"+i]._x = x ;
_root["clip"+i]._y = y ;
_root["clip"+i]._xscale = 3;
_root["clip"+i]._yscale = 3;
_root["clip"+i].imageHolder_mc.loadMovie("image"+i+".jpg");
_root["clip"+i].onRollOver = function() {
trace("hello world");
}
function mytime(){
trace("hello");
}
timer = setInterval(mytime,1000);
} while (i<15);
Any ideas.
thanks in advance
How To Lay My Page Out Properly? Graphic Grids?
Hi,
Ive been designing websites for a while now, Mainly using html and css for layout. Ive just got in to flash and now find it quite hard to lay my pages out so they look clean and professional-you know what i mean.
Im not a qualified graphic designer but have heard about graphic grids and their use in setting pages out. One book ive found on amazon in particular-
Grid Systems in Graphic Design
by Josef Muller-Brockmann , Josef Muller
-is highly recommended but im wondering if its applicable to web design.
Could anyone tell me how they go about setting a page out so it looks right.
Do you use the graphic grid or just play until you get it right????
Generating Random Square Grids
Hi all,
I'm assigned to do the portfolio section for my company's website and my supervisor has specifically told me what he wanted in terms of navigation and layout. Basically, he wants each portfolio piece to be square and in the form of 7 x 7 square grids. Each square's dimension is 100x100 px. He wants each portfolio piece to load randomly every time the page loads, so that it makes a shape of jigsaw puzzle-like if the piece is less than 49. Each image needs to be imported externally so that when we have more portfolio, we can simply added it to the array. Each portfolio piece should behave like a button that links to a bigger image.
I was able to get it to the point where the squares are generated dynamically on 7x7 square grids ( I used script from "Flash Hacks" book by Sham Bingal) Now I'm trying to develop the script to get it to work like my supervisor wanted. Can someone help me modify the script or at least give some hints on how to execute this.
Here is a link to download the fla file:
http://www.bionicrab.com/portfolio_test.fla
Thanks a bunch
Buddy
Eval() Nightmare/dynamic Grids From Array
to start out, I have a function call in which I would like to us the value of an array cell as an argument. Caused a bit of trouble at first but found a working solution in ...
moveit(eval(community[startpoint]), startX, startY);
where community[i] is the name of a movieclip im going to move
real trouble,
I am calling this function from within a for loop, that moves the movieclips into position in a grid ... and what I would like to do and cant seem to make work, is to have the for loop to position in the grid become a function whose argument is the name of the array to call from.
in other words I have 4 arrays
function call:
gridfunction("community");
function declaration:
function gridfuntion(arrayname) {
moveclip(eval(eval(arrayname)[startpoint]), 40, wheretostartY);
}
can somebody help please.
Thanks
Thomas Kearns
Professional Office
sand_box
3853 n Sacramento Ave
Chicago, IL 60618
v: 312.720.3750
f: 773.463.2347
thomas@sndbx.com
Academic Office
College of Architecture, IIT
3410 S State Street, Rm112
Chicago, IL 60616
kearns@iit.edu
Problems With Overlapping Grids (mouse Handling)
I have a file I am working on, where I have 3 grids overlapping each other in a square space. The top grid has 4 red squares, the middle grid has 16 blue, and the bottom green grid is 8 x 8.
I want overlapping mc's to act as doors for the mc's beneath. Selecting the upper left red square, peels that mc away, allowing access to the 4 blue squares beneath, etc. No blue or green mc should be selectable, unless the mc above has been removed. Its working fairly well, except this last problem that really has me stumped. When trying to select several squares at once, it only works when starting at the bottom right, working back. Starting with the upper left square, then quickly moving to the bottom right, will not allow access to the blue mc's even after the red one has been removed. Im sure this will only make since if you take a peek at it. Thanks in advance - I'm going to go rub my knuckles further into my eye sockets.
link to problem
Cold Fusion 6.1 *Upgrade?* And FlashMX Data Grids
Man, that's a long title.
So, here's the issue:
- We've developed a project using a FlashMX Data Grid and it worked juuuuust right using CF 6.0.
- Then, we upgraded our server to CF 6.1 and guess what…the Data Grid no longer works (we can't get content to update the view, although it does update in SQL2000).
- So, we've loaded the application back onto a CF6.0 server and it works juuuuuus right.
Anyone run into this?
Any ideas about how to modify/correct the issues on 6.1?
-=-=-=-=-=-=-=-=-=-=
Brian Slawin
Director, e-Media
www.Group360.com/emedia
314.423.8383 x523
-=-=-=-=-=-=-=-=-=-=
Distorted Text In Resized Buttons And Data Grids
I have searched the forums but have not seen anyone posting on this issue.
I am using Flash MX 2004 Pro and building a flash-based application that communicates with a server via XML. The application is set up so that the flash application resizes to the window size of the browser on startup.
What I am finding is that the resizing of the text within buttons and datagrid headers (column headers) do not seem to be resizing correctly upon display. Yet, if I pass the mouse cursor over the buttons, or in the case of the datagrid, if I manually drag the column to a new width (even ever so slightly), the text then redraws correctly. The most common effect is that the text gets "cutoff" on the last few characters even though the display area clearly has enough room to show the additional text. In addition, the buttons are marked has having the text 'centered', yet when the browser window is resized, the fonts are changed on the button text...but the text is not "centered" in the button until I pass the mouse cursor over them. Then they redraw and center rather nicely.
Has anyone seen this behavior before? I have looked to see if there were upgrades to the controls or some such but I have not found anything. I have tried to get the controls to 'redraw' on display programmatically to see if that would help (because forcing a redraw by changing the column width on the datagrid seems to fix the display issue) but I have been unsuccessful with that as well.
Any thoughts on the matter would be greatly appreciated.
Peter S. Lee
Edited: 01/09/2007 at 05:02:27 AM by PLee_Flash
Arrays & Grids/Lists - This Is How To Incrementally Move Items Up And Down...
Every now and then I learn something trivial, yet still new. This is probably one of several ways to do this...
"myData" is an array that contains information displayed in "myDataGrid". "toBeMoved" is a variable containing, um, the item to be moved.
btn_up.onRelease = function() { // this is a button to move items UP in the list
whoseSelected = myDataGrid.selectedIndex; // gets the index # for the selected row/item
if (whoseSelected > 0) { // makes sure you dont have the already top item selected
toBeMoved = myData[myDataGrid.selectedIndex]
myData[myDataGrid.selectedIndex] = myData[myDataGrid.selectedIndex - 1];
myData[myDataGrid.selectedIndex - 1] = toBeMoved;
myDataGrid.dataProvider = myDataGrid.dataProvider; // refreshes the grid
} else {
trace ("Item is already at the top of the list - can't move it any higher!");
};
};
};
btn_down.onRelease = function() { // this is a button to move items DOWN in the list
whoseSelected = myDataGrid.selectedIndex; // gets the index # for the selected row/item
if (whoseSelected > < myDataGrid.length) { // makes sure you dont have the already last item selected
toBeMoved = myData[myDataGrid.selectedIndex]
myData[myDataGrid.selectedIndex] = myData[myDataGrid.selectedIndex + 1];
myData[myDataGrid.selectedIndex + 1] = toBeMoved;
myDataGrid.dataProvider = myDataGrid.dataProvider; // refreshes the grid
} else {
trace ("Item is already at the bottom of the list - can't move it any lower!");
};
};
};
Do with it what you want. On the rare occasion that I figure something out I try to give back a bit since this site taught me quite a bit.
Fading And Reverse Fading Text
I'm so new to this it's sick. But I figure I can take a few days and learn as much as I can. I'm building a website wherein I'll have a splash page before entering the main contents of the site.
I'm using Flash 5. On the splash page I want to know how to create a text object that appears in a 'reverse fade' fashion. I imagine a 'reverse fade' function can be done with any object or graphic - I've seen it on these awesome websites listed at FK.
I don't know if I'm evening asking this question right. I'm able to use CoffeeCup Firestarter and make things appear and fade easily (duh - who couldn't with that program) but can't view the code the Firestarter program produces in order to learn how it happened.
Appreciate any help someone could give me.
Thanks,
Jeff
|