Creating Multiple Size Formats
I need to create a Flash movie that needs to fit into several different size banners. I am trying to figure out the best approach- does anyone have any experience doing this, and if so, how did you go about it?
FlashKit > Flash Help > Flash MX
Posted on: 11-07-2005, 05:35 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Multiple Formats In Dynamic Text
Hi, everyone. I have a question about text formating that I'm sure someone can answer for me.
I'm pulling an array from a MySQL database that is updated via a runtime on the systems of my content providers to keep them from mucking up the site
The script as it stands, pulls the Title, Client, and Description of each piece, newest to oldest, from the array and plops them out with some line breaks to make it look readable.
Currently, all the strings are placed via += into the same text field, which is then scrollable using the standard ScrollBar UI Component.
See the working model here.
What I'd like to do is to format the title such that it is a bit bigger, and a different font, bold. Format the client so it's light gray and small, and the text as something more uniformly readable. Not too hard with static text, a big harder than I expected dynamically.
I read up on TextFormat objects, but the only way I can see to implement this in a scrollbar is to use one dynamic text field -- and the only method I can see of dynamically using multiple text styles in one field is to designate the start and stop points of the style change as character numbers.
The whole point of using flash rather than PHP to display this on the page was centered around text formatting and scrollability. I have half the mission complete, but just can't seem to get ahold of this text problem.
Any solutions? Is using one text field the best idea or should I be dynamically creating fields in a movie clip and then scroll the whole clip?
Thanks a bunch.
- Aiden
Multiple Text Formats On One String
Anyone know how I can make one String, displayed in a TextField, have different text formats? So half could be coloured red and the other half green, for example.
dai2
Bring Up Flash Presentation In Multiple Formats With Hyperlinks?
I have a web site that is 100% flash http://rcgov.org/firedept when it comes up as you can see the center section is always the same starting flash .swf. If you click on the various buttons other .swf files load in the center section of this page. What I need to know is can I create a link on another web site that when clicked will open up my site but with something other than the initial screen in the center. Can I tell flash from a link to load with something other than the initial page running?
Bill
Edited: 08/24/2007 at 12:05:20 PM by NetBossUSA
Multiple Text Formats In Dynamic Text Box
inside a scrolling text box i want to have multiple text formats. i.e the text in the text box is a bunch of quotes.
"band to watch"
-ALTERNATIVE PRESS
i would like to have the top text to be regular and the bottom line be bold and italicized. It appears as though it will work but then when i publish it the bottom line is just caps.
is this possible?
Multiple Text Formats In Dynamic Text Box
inside a scrolling text box i want to have multiple text formats. i.e the text in the text box is a bunch of quotes.
"band to watch"
-ALTERNATIVE PRESS
i would like to have the top text to be regular and the bottom line be bold and italicized. It appears as though it will work but then when i publish it the bottom line is just caps.
is this possible?
[CS3] Issues Creating Multiple MC From Multiple Variable Data Arrays.
I have had some great help with this from some very kind FlashKit members. However I have played with the code extensively and am having an issue getting multiple MC's from the global variable arrays "V_1", "V_2" and "V_3".
Right now I have the code set to build up a scalable graph for array V_1. I have not had it working "properly" to show the other values in graphs side by side for V_2 and V_3. I have had some weird Frankenstein looking results that led me to believe I was on the right track, but only to find that I could not figure it out. I have a g_seperator variable that I was hoping to use to determine the space between each column of data.
Can anyone out there help me please?
Thank you.
here is my code reprinted here, since my flavor of Flash may not export to a version compatible with some of your working versions.
Code:
stop();
//BAR ATTRIBUTES
_global.g_x = 240;// chart starting x position
_global.g_seperator = 130;// distance between bars
_global.g_width = 50;// graph segments width
_global.g_base = 450;// graph starting Y position
_global.g_alpha = 40;
//BOX VALUES
_global.v_1 = new Array(20, 40, 1, 10, 12, 10, 20, 15, 5, 21, 31, 50, 20, 10, 20);
_global.v_2 = new Array(60, 70, 1, 10, 42, 10, 50, 15, 30, 21, 31, 10, 20, 10, 20);
_global.v_3 = new Array(20, 70, 1, 10, 12, 10, 20, 25, 10, 31, 31, 10, 20, 10, 20);
_global.color_set = new Array(0x000099, 0x00FF00, 0xddddd, 0xcccccc, 0x990000d, 0xff9900, 0x99eeee, 0x99cccc, 0xf21000, 0xffdddddd, 0x005900, 0xff00ff, 0x0ff000, 0xff9999, 0xf2f321);
_global.pos_name = new Array("Site3", "Site5", "Site7");
var home = this;
draw1NPositions("mc_pos"+[p],pos_name[p],g_seperator);
function draw1NPositions(mc_pos, positionName, gap) {
this.createEmptyMovieClip(mc_pos,1000);
for (i=0; i<v_1.length; ++i) {
makeBox(i,g_x,g_base,g_width,v_1[i],color_set[i]);
}
}
function drawBox(mc, w, h, color) {
mc.beginFill(color);
mc.lineStyle(0,color,100);
mc.moveTo(0,0);
mc.lineTo(0,-h);
mc.lineTo(w,-h);
mc.lineTo(w,0);
mc.lineTo(0,0);
mc.endFill();
}
function makeBox(num, posX, posY, wide, tall, color) {
var myBox = home.createEmptyMovieClip("box_mc"+num, num);
myBox._x = posX;
myBox._y = posY;
myBox.num = num;
myBox.dragging = false;
drawBox(myBox,wide,tall,color);
myBox.onMouseUp = function() {
this.dragging = false;
};
myBox.onMouseDown = function() {
if (this.hitTest(_xmouse, _ymouse) && !this.dragging) {
this.startY = _ymouse;
this.startX = _xmouse;
this.startH = this._height;
this.dragging = true;
}
};
myBox.onEnterFrame = function() {
for (var i = 1; i<v_1.length; i++) {
boxes[i-1].y = home["box_mc"+(i-1)]._y=home["box_mc"+i]._y-home["box_mc"+i]._height;
}
};
myBox.onMouseMove = function() {
if (this.dragging) {
dist = this.startH-(_ymouse-this.startY);
boxes[this.num].h = this._height=(dist>1) ? dist : 1;
_root.boxValue.text = this._height;
}
};
Mouse.addListener(myBox);
}
Changing The Size Of Multiple Objects In Multiple Keyframes
I have a movie with 10 keyframes is it possible to resize an image in all of the keyframes, without having to select each keyframe individually?
If you use select an highlight all keyframes it only changes the last keyframe to selected.
Thx
Creating A Pop-up Window Of Fixed Size.
I'm trying to enlarge a thumbnail onto a new window of a fixed size (where I can specify the width and height). I can do this using Javascript but don't know how to do it in my Flash site. Please help.
Creating An FLV File With 300x250 Size, But Video Isn't?
I am trying to create a video ad that is 300 x 250 px in size.
Now, the video, when resized to 300 width, is only 127 px high because its a wide screen video.
I have Flash 8 Pro. Can I export the FLV file so that the video plays inside a black 300 x 250px container (that is a part of the FLV FILE) versus having to create a separate HTML container with those dimensions, and then centering the video box inside it?
Thanks,
Bryan
Creating Multiple Variables Using A
Hey,
Hopefully someone has figured out how to do this...
It should be fairly simple.
I need to assign the numbers 1-30 to the variables b1 to b35 randomly.
basically I need to know how to use a for loop to create these variables.
maybe something like this:??
for (start = 0; start <= 30; start++){
b+start = start
}
except that I can't seem to get the variable name to randomly change.
maybe arrays??
HELP please!!
Creating Multiple Objects
In my movie i have 3 movieClips called _parent.allelements.level_1, _parent.allelements.level_2
_parent.allelements.level_3
within each of these their is a set of 3 more movieClips named _parent.allelements.level_1.select1, _parent.allelements.level_1.select2, etc
i used the following code to create a color object for each of the second level movieClips
for (m=0; m<3; m++) {
for (n=0; n<3; n++) {
_parent['colour'+m+"_"+n] = new Color(_parent.allelements['level_'+m]['select'+n]);
}
}
Then later on i used the following code to select only a certain number of the second level movieClips and alter their color using set transform.
for (m=0; m<3; m++) {
for (w=0; w<3; w++) {
if (_parent.allelements['level_'+m]['select'+w].isnotselected == 2) {
_parent['colour'+m+"_"+w].setTransform({ra:100, ga:100, ba:100, rb:_parent.allelements['level_'+m].zpos*multipl, gb:_parent.allelements['level_'+m].zpos*multipl, bb:_parent.allelements['level_'+m].zpos*multipl, aa:100, ab:100});
}
}
}
For some reason this code only works on Clips
_parent.allelements.level_1.select1, _parent.allelements.level_1.select2
_parent.allelements.level_1.select3
in other words only the clips inside the first movieClip _parent.allelements.level_1. I'm sure the if statement is working correctly. Idouble checked that. But i can't see what else i am doing wrong any input would be very mch appreciated
Creating Multiple Sprites In AS3
Hello,
I am having trouble getting some of my old AS2 methods working in AS3.
here is an example of how I used to create multiple movie clips with AS2 and draw in them and position them.
Code:
var colourList:Array = [0x0000FF, 0x00FF66, 0x33FFFF, 0x663300, 0x669933,
0x0000FF, 0x00FF66, 0x33FFFF, 0x663300, 0x669933,
0x0000FF, 0x00FF66, 0x33FFFF, 0x663300, 0x669933];
var blockWidth:Number = 25;
for(i=0; i<=colourList.length; i++){
_level0.createEmptyMovieClip("block"+i, this.getNextHighestDepth());
_level0["block"+i].createEmptyMovieClip("blockHold"+i, 0);
with(_level0["block"+i]["blockHold"+i]){
lineStyle(2,0x333333,blockWidth);
beginFill(colourList[i], 60);
lineTo(blockWidth,0);
lineTo(blockWidth, blockWidth);
lineTo(0,blockWidth);
lineTo(0,0);
endFill();
}
_level0["block"+i]._x = blockWidth*i;
_level0["block"+i]._y = blockWidth*i;
}
How might i in particular achieve these two things with AS3:
A) creating multiple instances of screen objects
and
B) doing things to them in relation to array properties?
thanks
Rob
Should I Still Be Creating Multiple Swfs?
Hi everyone,
I'm a seasoned(ish) flash user since flash4, with a design background I usually managed to get things to work the way I wanted.
I'm pretty new to AS3 so I've brought and read the following:-
Essential Actionscript 3.0 (O'Reiley)
Object-Oriented Actionscript 3.0 (Friends of ed)
Actionscript 3.0 Design Patterns (O'Reiley)
I get the Classes stuff, I get the inheritance, polymorphism, (certain) Patterns, why we use them and kind-a when to use them.
What I'm still struggling with is .....
Should I still be creating multiple swfs?
In the old days, I'd have created a base.swf movie to store all my globally accessible vaiarables. If I wanted to check a languageID i'd call _level0.LanguageID from any other level movie.. easy.
I'd planned for the levels I'd use e.g. Menu.swf on level 3, Content.swf on level 2, Alerts.swf on level 5 etc. Everything worked just fine.
In all of the books that I've read (skim-read some parts), and various online tutorials, it seems that a real life project i.e. anything that is more than a simple demonstration of one class or concept is never discussed. Even the complex examples never touch on multiple swfs in a project.
So, the KILLER question is....
Should I be trying to build everything into a single (possibly large) base movie?
OR
Should I be loading menu.swf etc. into the displayList?
My current considered approach is...
If the second answer is the correct way then,
would a singleton in the main.swf and a whole bunch of custom event handlers be the correct approach?
Any help, pointers, inspiration would be greatly appreciated
Thanks for your time (sorry it turned into a bit of an essay!)
MrFish
Creating Multiple Textfields
If I want to create textfields like this where represents the number of textfields to be created.
_level0.paneContent.createTextField("mytext"+i, 1, 100, 100, 300, 100);
How can I get the properties of each textfields?
_level0.paneContent.mytext +i.text = something;
Creating Multiple Objects: Can Ya?
There are 10 sets of data with four variables each. I want to loop through the data and create 10 objects and add the four pieces of data.
This is what I was trying in a for loop:
module[i] = new Object();
module[i].ppt = ecPath+"_"+num+".jpg";
module[i].toc = toc;
module[i].txt = txt;
module[i].voc = ecPath+"_"+num+".voc";
Then trace, but I get undefined.
trace(module[i].ppt);
trace(module[i].voc);
trace(module[i].toc);
trace(module[i].txt);
I know I'm doing this wrong. Please offer any guidance or better way of methodology. Appreciate the expertise in this community...
Creating Multiple TextFields
I thought I knew what I was doing.
I'm creating a logbook form that has about 500 different input textFields. Using a simple for loop, I trying to create a portion of the textFields then change their properties to an Input textFeild that is prepopulated with data.
Here's the code:
var maxColumns:Number = 10;
var maxRows:Number = 8;
var tc_TabOrderStart = 13;
var xStart:Number = 256;
var yStart:Number = 123;
var xOffset:Number = 46.3;
var yOffset:Number = 21.8;
var txtFieldWidth:Number = 41;
var txtFieldHeight:Number = 81;
for (var j:Number = 0; j<maxRows; j++)
{
for (var i:Number = 0; i<maxColumns; i++)
{
var tc_tfld:String = "tc"+j+"_"+i;
trace("tc_tfld = "+tc_tfld);
this.createTextField(tc_tfld, this.getNextHighestDepth(), xStart+(xOffset*i), yStart+(yOffset*j), txtFieldWidth, txtFieldHeight);
with (this.tc_tfld)
{
type="input";
text = "DUMB";
}
}
}
Thanks for any help. I've been stuck for three days.
Creating Multiple Movieclip
Hello to all!!!
It is posible to create multiple movieclip in stage by clicking one button with different instance name.
Creating Multiple Variables At Once?
Hi
Is it possible to create multiple variables at once?
I have the following code that I am using over and over, and rather than retype it each time, I am wondering if there's a way to put it inside a function, so that each variable is created on the fly.
Here's the code that I'm using now:
var menuName0LV:LoadVars = new LoadVars ();
menuName0LV.onLoad = function (success) {
if (success) {
menuLoader();
} else {
menu0_MC.textLabel.text = "error";
}
}
var menuName1LV:LoadVars = new LoadVars ();
menuName1LV.onLoad = function (success) {
if (success) {
menuLoader();
} else {
menu1_MC.textLabel.text = "error";
}
}
And so on. I create as many variables as I have movie clips for them-- anywhere from 1 to 25, say.
I tried calling and using the variables by putting them inside a function, and then calling the function, but it didn't seem to work--
menuArray_array = new Array();
function createVariables () {
for (g = 0; g < 5; g++) {
menuArray_array[g] = _root["menu" + g + "_MC"];
x = eval("menuName" + g + "LV");
var x:LoadVars = new LoadVars();
x.onLoad = function (success) {
if (success) {
menuLoader();
} else {
menuArray_array[g].textLabel.text = "error";
}
}
}
}
createVariables();
Any ideas?
Font Size Increase - Creating Scorll Bars
Hello,
I have a normal dynamic text box and I have included an increase text size button to aid usability. However, the text area is small so when the text is enlarged it runs out of the text area.
Is it possible to dynamically increase text size which automatically creates a scroll bar in the text area?
Thanks, Rob
Multiple Movies Same Size
Hi,
I'm loading multiple movies of the same size that are replacing one another, each movie fills the entire screen.
Each movie has the same sub movie clip called menu in the top left corner that contains buttons for moving from one main movie to aonther.
The movies load and replace each other fine but between each movie they play a small part of one of the previous movies viewed depending on which one was viewed first.
how can I keep this from happening? I want each movie to load, play and stop until a button the menu movie is pressed. Is their a better way of laying this out other than having the movies replace each other on the same level? Should I seperate the menu?
thnx
Set Size + Position Of Multiple MCs
Hello all,
I want to be able to click a button which will tell multiple clips to go to specif x/y locations and be specific dimensions. I have code which will do this with ONE object:
http://henrydesign.ca/MoveMC.swf
I'd like to have a few objects be told where to go with that single button release.
I have a way to do this now, but I feel the code is bloated and inelegant. I am looking for that nice, simple piece of code that is as minimal as possible.
An .fla is attached.
With thanks!
sumsum
Multiple Rectangles Size And Pos
If someone can help me w/ the logic. Feeling very, very rusty. Brain fried again.
I have 5 rectangle mc's. All different sizes and different positions.
I have a final size and position.
I want to click on 5 different buttons and make the corresponding mc grow and move to the desired final size.
here's an example.... that is obviously not working.
Multiple Rectangles Size And Pos
If someone can help me w/ the logic. Feeling very, very rusty. Brain fried again.
I have 5 rectangle mc's. All different sizes and different positions.
I have a final size and position.
I want to click on 5 different buttons and make the corresponding mc grow and move to the desired final size.
here's an example.... that is obviously not working.
Creating Multiple Movie Clips
Hi there - here is what I'm trying to achieve:
I have a m/c of a small square rotating from edge on to face on via it's Y axis. I want to now, using duplicateMovieClip, create 25 of these, in a grid 5 x 5, one after the other, playing as they are created.
I know how to create the 25 duplicates, using Linkage in the library and something like this:
Code:
for (i=1; 1<=25; i++) {
square_mc.duplicateMovieClip("square" + i + "_mc", i)
}
But once they are created, how do I reposition them? Also I will need to be able to determine once 5 are created so that a new line is started.
Would it be something like this: Set a first X and Y position before the loop and after each pass, use -
Code:
this._x = n + somenumberofpixels
this._y = g + somenumberofpixels
where n is the preset _x before the loop and g is the preset _y before the loop and somenumberofpixels is the size of the square after full rotation plus a little gap inbetween?
Sorry my text sounds/reads a bit messy; I can see the solution, but I just don't know how to reach it.
cheers
frank
Creating Single Mc From Multiple Mcs On Different Layers
Could someone tell me how to take multiple layers of already created movie clips and combine them into one movie clip? It's easy to create a movie clip of a movie clip, but I'm not sure how to do so in this case.
Also, is it possible to do the same thing for a layer of shape tweens?
TIA,
aaroneousmonk
Creating Multiple Mask Layers
How can you link more than one mask to a layer.......need to know since motion tween only supports one symbol per layer
Creating Multiple Variables Dynamically
Hello,
I've got a for loop creating x number of duplicate movies...that's all cool and happy. But I want to create x amount of variables on the main time line dynamically. I've set up a function on the main time line that is called each time the for loop does its thing...obviously it wont work as is...but how do I get something like this working?
code:
function createVars(amount) {
markerLocVar = "_root.marker"+amount+"loc";
markerXVar = "_root.marker"+amount;
eval(markerLocVar)= eval(markerLocVar)._x;
}
Say the amount of times this is called is 3 times. I would like 3 variables created by the code called and located:
code:
_root.marker0Loc;
_root.marker1Loc;
_root.marker2Loc;
any help would be great! Thanks!!
ss
Creating A Search For Multiple Fields
Hi there
I am needing to create a search box that will search on multiple fields from a SQL database. This is for a local intranet and I have no idea where to start. I am just a beginner at this and have very basic coding skills. any help would be greatly appreciated.
Help With Creating Multiple MC,(source Included)
okay here is what I have on the stage in layer called enemy :
Code:
//basic def
this.depth2 = 1;
//i = random(6)+1;
for(a=0;a<6;a++) {
enemyName="oneEnemy"+String(this.depth2++);
this.attachMovie("applets", enemyName, this.depth2);
}
and here is the code for the mc "applets"
Code:
//basic definitions
enemyx = random(400)+50;//_root['oneCloud'+_root.i]._x;
enemyy = -10;//(_root['oneCloud'+_root.i]._y)+5;
this.state = 0; //frame number
this.chooser = random(2)+1; //chooses left or right
//spc = 0;
if(this.chooser == 1) {
this.state = 1;
}
else if(this.chooser == 2) {
this.state = 3;
}
gotoAndStop(1);
enemyvx = -2;//(_root['oneCloud'+_root.i].cloudv); //velocity along x
enemyvy = 0; //velocity along y
yFriction = 1.6; //acceptable values: 2.2 --> 1.6
xFriction = 1.05;
acceleration = 9.8; //gravity
time = Math.floor(getTimer()/1000); //time in whole seconds
this.onEnterFrame = function() {
enemyx += enemyvx; //add velocity to x
enemyy += enemyvy; //add velocity to y
this._x = enemyx; //set x coordinate
this._y = enemyy; //set y coordinate
enemyvx = (enemyvx/xFriction); //lower xvel with horizontal friction
enemyvy = (enemyvy + acceleration + time)/(yFriction); //calculate new velocity
time = Math.floor(getTimer()/1000); //update Time
/*if(spc == 1 || spc == 2 || spc == 3) {
this.state += 1;
gotoAndStop(this.state);
}
else if(spc == 4 || spc == 5 || spc ==6) {
this.state -= 1;
gotoAndStop(this.state);
spc=1;
}
spc++;*/
}
when i test movie nothing shows up, why is this?
Creating Multiple Movieclips And Controlling Them
Okay so i have actionscript that creates a ball and places it outside of the stage and moves it across the stage for a game im trying to make and i have it working for 1 ball but i want to be able to create another ball that moves at the same time as the first... please respond if you don't understand. I'll show you waht i have for it working for one ball and what i have for what i tried to do which resulted in it not moving the balls at all.
var i = 0;
var speed = 30;
var x1 = Math.floor(Math.random() * 550);
var x2 = Math.floor(Math.random() * 550);
var y1 = -50;
var y2 = 450;
var xdistance = x2 - x1;
var ydistance = y2 - y1;
var xmove;
var ymove;
setInterval(drawBall, 10000);
function drawBall()
{
i++;
_root.attachMovie("ball", "ball" + i, getNextHighestDepth());
createball("ball"+i);
}
function createball(ball)
{
trace(ball);
var rand = Math.floor(Math.random() * 4);
if (rand == 1)
{
//from top
xmove = xdistance / speed;
ymove = ydistance / speed;
ball._x = x1;
ball._y = y1;
_root.onEnterFrame = function()
{
ball._x += xmove;
ball._y += ymove;
};
}
else if (rand == 2)
{
//from bottom
ydistance = y1 - y2;
xmove = xdistance / speed;
ymove = ydistance / speed;
ball._x = x1;
ball._y = y2;
_root.onEnterFrame = function()
{
ball._x += xmove;
ball._y += ymove;
};
}
else if (rand == 3)
{
//from left
x1 = -50;
x2 = 600;
y1 = Math.floor(Math.random() * 400);
y2 = Math.floor(Math.random() * 400);
xdistance = x2 - x1;
ydistance = y1 - y2;
xmove = xdistance / speed;
ymove = ydistance / speed;
ball._x = x1;
ball._y = y2;
_root.onEnterFrame = function()
{
ball._x += xmove;
ball._y += ymove;
};
}
else
{
//from right
x1 = 600;
x2 = -50;
y1 = Math.floor(Math.random() * 400);
y2 = Math.floor(Math.random() * 400);
xdistance = x2 - x1;
ydistance = y1 - y2;
xmove = xdistance / speed;
ymove = ydistance / speed;
ball._x = x1;
ball._y = y2;
_root.onEnterFrame = function()
{
ball._x += xmove;
ball._y += ymove;
};
}
}
and for the working for one ball i have...
var i = 0;
var speed = 30;
var x1 = Math.floor(Math.random() * 550);
var x2 = Math.floor(Math.random() * 550);
var y1 = -50;
var y2 = 450;
var xdistance = x2 - x1;
var ydistance = y2 - y1;
var xmove;
var ymove;
_root.attachMovie("ball", "ball", getNextHighestDepth());
createball();
function createball()
{
var rand = Math.floor(Math.random() * 4);
if (rand == 1)
{
//from top
xmove = xdistance / speed;
ymove = ydistance / speed;
ball._x = x1;
ball._y = y1;
_root.onEnterFrame = function()
{
ball._x += xmove;
ball._y += ymove;
};
}
else if (rand == 2)
{
//from bottom
ydistance = y1 - y2;
xmove = xdistance / speed;
ymove = ydistance / speed;
ball._x = x1;
ball._y = y2;
_root.onEnterFrame = function()
{
ball._x += xmove;
ball._y += ymove;
};
}
else if (rand == 3)
{
//from left
x1 = -50;
x2 = 600;
y1 = Math.floor(Math.random() * 400);
y2 = Math.floor(Math.random() * 400);
xdistance = x2 - x1;
ydistance = y1 - y2;
xmove = xdistance / speed;
ymove = ydistance / speed;
ball._x = x1;
ball._y = y2;
_root.onEnterFrame = function()
{
ball._x += xmove;
ball._y += ymove;
};
}
else
{
//from right
x1 = 600;
x2 = -50;
y1 = Math.floor(Math.random() * 400);
y2 = Math.floor(Math.random() * 400);
xdistance = x2 - x1;
ydistance = y1 - y2;
xmove = xdistance / speed;
ymove = ydistance / speed;
ball._x = x1;
ball._y = y2;
_root.onEnterFrame = function()
{
ball._x += xmove;
ball._y += ymove;
};
}
}
the fla can be found at http://giraph.ath.cx/testangles/ballmovetest004.fla
and the swf at
http://giraph.ath.cx/testangles/ballmovetest004.swf
please respond if you need any clarifaction
Creating Multiple Text Fields
I try to create with loop more text fields but i my code no works ;(
Code:
for (i = 0; i < total; i++)
{
var_descr_gall = "descr_gall_" + i;
_root.createTextField (var_descr_gall, i, 0, 0 * i, 200, 20);
var_descr_gall.border = true;
var_descr_gall.text = "aaa";
trace ("var_descr_gall = " +var_descr_gall.text );
}
}
The var_descr_gall.text is undefinied.
Later i need load in this text fields content of XML. Something like that:
Code:
var_descr_gall.text =xmlNode_gal.childNodes[i].childNodes[0].firstChild.nodeValue;
Thanks
Creating Multiple Textfields Programatically
hi I am doing some work with creating textfield programatically.
USING mx2004
The code is written to create 2 text fields with properties based on the value of tmp[i].
I am having trouble applying text formatting after I have created each of the texfields.
ANy Ideas? I have tried using eval("myTextFormat" + i) instead of just myFormat, it causes a syntax error. How can i get the formatting to apply for each textfield?
Thanks
______________________________________
CODE FOLLOWS
______________________________________
var jsVar1 = "100,50,ff,0xff0000,24,Verdana,false,false|100,100 ,gg,0xff9900,24,arial,false,false";
var elements = jsVar1.split("|");
trace(elements.length);
for(i = 0; i <= elements.length-1; i++)
{
tmp = elements[i].split(",");
for( k = 0; k <= elements.length-1; k++)
{
_root.createTextField("myPoint" + i , 100 + i ,100,100,85,85);
eval("myPoint" + i)._x = tmp[0];
eval("myPoint" + i)._y = tmp[1];
eval("myPoint" + i).text = tmp[2];
myFormat = new TextFormat();
myFormat.color = tmp[4];
myFormat.size = tmp[5];
myFormat.font = tmp[6];
eval("myPoint" + i).setTextFormat(myFormat);
}
}
Creating Multiple NetStreams Dynamically?
hi guys..i am trying to get multiple videos to dynamically load and play on the stage. I think i am getting close, but i am hung up on how to duplicate the netStream class in the funciton. I know that the videos will not work using only one netStream. Any ideas on how to create multiple streams?
Code:
var ncConnect:NetConnection= new NetConnection();
ncConnect.connect(null);
var mcHolder:MovieClip=this.createEmptyMovieClip("mcHolder",2005);
var vidXML:XML= new XML();
vidXML.ignoreWhite=true;
vidXML.onLoad=function(){
var root=vidXML.firstChild.childNodes;
for(i=0;i<root.length;i++){
var vidThumbs=mcHolder.attachMovie("mcVideo","mcVideo"+i,i);
var videos:Video=vidThumbs.theVideo;
videos.attachVideo(streams);
var streams:NetStream= new NetStream(ncConnect);//here is where i am stuck!
streams.play("images/"+root[i].attributes.videoSource);
}
}
vidXML.load("images/Videos.xml");
Creating Multiple Similar Movieclips?
I want to create multiple movieclips (with the same behaviour and looks) by pressing enter. Or any other action, but for now I put it under an enter for testing.
The code below makes a new clip the first time enter is pressed, but instead of creating a new movieclip after that, it just seems to reset the previous movieclip.
Code:
if (Key.isDown(Key.ENTER)) {
if ( nrOfBalls < 5 )
{
this.attachMovie( "PingPong", "PingPong"+nrOfBalls, 0 );
nrOfBalls += 1;
}
}
What am I doing wrong?
Creating Multiple MovieClips With ActionScript
For some reason both movieClips are instantiated but gets loaded but my second movieClip will not load the png image. What am i doing wrong
Thanx Marijntje
Code:
this.createEmptyMovieClip("navigation_mc", this.getNextHighestDepth());
var navigationListener:Object = new Object();
navigationListener.onLoadInit = function(){
navigation_mc._width = 800;
}
var navigationBackgroundLoader:MovieClipLoader = new MovieClipLoader();
navigationBackgroundLoader.addListener(navigationListener);
navigationBackgroundLoader.loadClip("http://www.h-g.dev/core/img/nav_bg.png", navigation_mc);
this.navigation_mc.createEmptyMovieClip("home_mc", this.navigation_mc.getNextHighestDepth());
var homeButtonListener:Object = new Object();
homeButtonListener.onLoadInit = function(){
//home_mc._width = 800;
}
var homeButtonLoader:MovieClipLoader = new MovieClipLoader();
homeButtonLoader.addListener(homeButtonListener);
homeButtonLoader.loadClip("http://www.h-g.dev/core/img/nav_home_nl_nl.png", home_mc);
Creating Multiple Movieclips With For Loop Help
How can I dynamically create multiple MovieClips and attach to the stage using a for loop?
for (var j:Number = 0; j<total; j++) {
var my_mc1:MovieClip = trackHolder.attachMovie("DefaultBtn", myHolder.getNextHighestDepth())
};
I need to change the name of my_mc1 to my_mc + j.
How can I do this.
Help appreciated
paulie
Creating Multiple Preloaders Problem
I have a gallery and I am trying to create a preloader for each thumb.
The thumbs load succesfully but the textfileds dont show anything and I get this error:
"Error #1010: A term is undefined and has no properties."
And its reffering to progressHandler function.
Code:
var imageLoader:Loader;
var external_txt:TextField;
var preloaderByURL:Array = new Array();
function processXML(e:Event):void {
myXML = XML(e.target.data);
var a:Number = myXML.image.length();
for (var i:Number = 0; i < a; i++) {
imageLoader = new Loader();
external_txt = new TextField();
external_txt.width = 30;
external_txt.autoSize = TextFieldAutoSize.LEFT;
external_txt.textColor = 0xFF0000;
var urlRequest:URLRequest = new URLRequest(myXML.image[i].@thumb);
preloaderByURL[urlRequest.url] = external_txt;
imageLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progressHandler);
imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, LoadComplete);
imageLoader.load(urlRequest);
imageLoader.x = (i * thumbsize);
external_txt.x = (i * thumbsize);
addChild(imageLoader);
addChild(external_txt);
}
}
function progressHandler(e:ProgressEvent):void {
preloaderByURL[e.target.url].text = int(100 * e.target.bytesLoaded / e.target.bytesTotal) + "%";
}
function LoadComplete(e:Event):void {
removeChild(preloaderByURL[e.target.url]);
}
}
If somebody can take a look at my code I would really appreciate it, I am quite new at AS3 and I would really like to make this work..
Thank you!
Creating Functions For Multiple Objects
Hi all,
once again with this thumbnail stuff!
I now have 10 thumbnails that are automatically generated via a script like this:
PHP Code:
var dif = 90; //difference in px
for(var i=0;i < 11;++i)
{
var inStep = i+1; //required for proper pic numbering
var myVar = "image" + inStep + ".jpg";
tmp = this._parent.holder1.createEmptyMovieClip("holder"+inStep,i);
tmp.LoadMovie(myVar);
tmp._x = dif*i;
}
So that loads 10 images in a row. Now i need to write a function that evaluates what one is pressed and passes a variable back. The variable thing is easy enough, but I don't know how make just one function that
can be called from any of the clips. I don't want to have to write an onRelease function for each of the clips and was wondering how others did things like this?
All i really need now is some function i can stick in one spot that will just trace the name of the clip that was clicked. Any help appreciated
THANKS
mcm
Trouble Creating Multiple Scenes
Hello all,
I am relatively new to actionscripting, so I have a question about a task that I want to complete but I do not know if it is do-able or not.
I have attached the .fla file if you would like to look at it. Here is my problem:
If you notice in the file, I have created a 'tsunami' button list. I want certain actions to happen on the other side of the divider that I created, once one of the 'tsunami' buttons are pressed. I cannot figure out if this is do-able or not.
For instance, once I press 'Contact' I would like a little animation to happen in that box and then have my contact info appear right next to it. Can somebody please help me figure out how to get this going correctly? Thanks a bunch.
-Will
Creating FLV Object W/ Multiple Movies
I am reviewing moving from WMV to FLV for viewing site video. We use ASX files to tie video content w/ pre-roll ad content, so when someone activates the video player it first plays the ad then plays the story content. Is it possible to do the same somehow with Flash Video?
Creating Multiple Text Fields
I try to create with loop more text fields but i my code no works
Code:
for (i = 0; i < total; i++)
{
var_descr_gall = "descr_gall_" + i;
_root.createTextField (var_descr_gall, i, 0, 0 * i, 200, 20);
var_descr_gall.border = true;
var_descr_gall.text = "aaa";
trace ("var_descr_gall = " +var_descr_gall.text );
}
}
The var_descr_gall.text is undefinied.
Later i need load in this text fields content of XML. Something like that:
Code:
var_descr_gall.text =xmlNode_gal.childNodes[i].childNodes[0].firstChild.nodeValue;
Thanks
Help...creating Multiple Empty Movieclips?
Hi all,
I needed some help creating some help with the .createEmptyMovieClip() method.
you see i have a variable rks and accoding to the amount specified in the rks,i want flash to create that number of movieclips
Thanks.
avi
Creating Multiple Function() With A Loop?
ActionScript Code:
for (var i:Number = 0; i<12; i++) { var myFunction_i:Function = function () { trace("This is function "+i); };}myFunction_5();
How do I achieve this?
I'm needing to create identical functions but different 'i' Number Variables so that I can call them as shown when I need to.
Please help ?
Creating A Class For Multiple Xml Galleries
I've been working with the code below that works with a single, xml driven image gallery. I'm trying to turn this into a class that I can use to handle calling multiple galleries from different xml files. I've created simple classes before but I'm getting hung up in figuring out which part of my existing code to use in this new class...particularly my loadThumbs function. I'm having trouble distinguishing which functions to include in the class and which to place on the main timeline.
Any suggestions with my existing code or does anybody know of an example class that performs a similar function that I could reference?
Code:
/*********************************************************************
LOAD THE XML
**********************************************************************/
var xmlLoader:URLLoader;
var xmlData:XML;
function loadXml(xmlFile:String):void {
trace(xmlFile)
xmlLoader= new URLLoader();
xmlData = new XML;
xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);
xmlLoader.addEventListener(IOErrorEvent.IO_ERROR, xmlLoadFail);
xmlLoader.load(new URLRequest(xmlFile));
}
loadXml("necklaces.xml");
function xmlLoadFail(event:IOErrorEvent):void {
trace("Looks like there was an error loading the XML");
}
function xmlLoaded(e:Event):void {
xmlData = XML(xmlLoader.data);
loadThumbs();
}
/*********************************************************************
LOAD THE THUMBNAILS
**********************************************************************/
var p:int = 0;
var changex:int = 0;
var changey:int = 0;
var paddingX:int = 21;
var paddingY:int = 50;
var pictureValue:int = 0;
var child:MovieClip;
var loader:Loader;
var thumbLoader:Loader;
var largeContent:Sprite = new Sprite;
addChild(largeContent);
//number of thumbs to show
var visThumbs:int = 3;
//load in the thumbnails
function loadThumbs():void {
thumbLoader = new Loader();
thumbLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loadThumbProgress);
thumbLoader.contentLoaderInfo.addEventListener(Event.INIT, thumbLoaded);
thumbLoader.load(new URLRequest(String(xmlData.pic.thumb[p])));//access the thumbnails
p++;
function loadThumbProgress(e:ProgressEvent):void {
trace("LOADED "+Math.floor(e.bytesLoaded / 1024)+ " OF "+Math.floor(e.bytesTotal/1024));
}
function thumbLoaded(e:Event):void {
if (pictureValue==0) {
//scroller pane
scrollPaneX = 30;
scrollPaneY = 60;
scrollPaneWidth = thumbLoader.content.width*visThumbs+(paddingX*(visThumbs-1));//mask
scrollTrackWidth = thumbLoader.content.width*xmlData.pic.length()+(paddingX*(xmlData.pic.length()-1))//scrolltrack
scrollPaneHeight = thumbLoader.content.height*2+paddingY;
constructScroller();//call the scroller constructor function
}
child = new MovieClip();
child.pictureValue = pictureValue++;
child.addChild(thumbLoader.content);
//event listeners for thumbnails
child.addEventListener(MouseEvent.MOUSE_OVER, overThumb);
child.addEventListener(MouseEvent.MOUSE_OUT, offThumb);
child.addEventListener(MouseEvent.CLICK, loadBigImage);
holder_mc.addChild(child);
TweenLite.from(child, 3, {alpha:0});
changex = thumbLoader.content.width+paddingX;
changey = thumbLoader.content.height+paddingY;
var rows:int = 2;
child.x = int((p/rows)-.1)*changex;
child.y = int(p%rows)*changey;
child.buttonMode = true;
thumbLoad_txt.text = "LOADED "+p +" OF "+(xmlData.pic.length ())+" THUMBNAILS";
if (p<xmlData.pic.length()) {
loadThumbs();
}
if (p==xmlData.pic.length()) {
addScrollListeners()
thumbLoad_txt.text = "";
loadBigImage(null, 0)
}
}
}
/*********************************************************************
LARGE IMAGE LOADING - HANDLE A CLICK ON THUMBNAIL
**********************************************************************/
function loadBigImage(event:MouseEvent = null, pictureToLoad:int = undefined):void {
var targetThumbs:int
if(event != null){
targetThumbs= event.target.pictureValue;
}else{
targetThumbs = pictureToLoad
}
loader = new Loader();
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loadLargeProgress);
loader.contentLoaderInfo.addEventListener(Event.INIT, loadLargeInit);
loader.load(new URLRequest(String(xmlData.pic.largeimg[targetThumbs])));
TweenLite.to(largeContent, .5, {alpha:0});
outPut_txt.text = "";//clear any previous descriptions text
//run when we have the big images content.
function loadLargeInit(e:Event):void {
if (largeContent.numChildren>0) {
largeContent.removeChildAt(0);
}
//position the loaded content
loader.content.x = 600;
loader.content.y = 105;
largeContent.addChild(loader.content);
largeContent.alpha = 0
TweenLite.to(largeContent, 4, {alpha:1});
load_txt.text = "";
outPut_txt.htmlText ="";
outPut_txt.htmlText = String(xmlData.pic.about[targetThumbs]);
}
//handle loading progress
function loadLargeProgress(e:ProgressEvent):void {
//trace("LOADED "+Math.floor(e.bytesLoaded / 1024)+ " OF "+Math.floor(e.bytesTotal/1024));
load_txt.text = "LOADED "+Math.floor(e.bytesLoaded / 1024)+ " OF "+Math.floor(e.bytesTotal/1024);
}
}
//thumbnail rollOver and Off handlers
function offThumb(event:MouseEvent):void {
TweenLite.to(event.target, 2, {alpha:1});//alpha in the thumbnails
}
function overThumb(event:MouseEvent):void {
TweenLite.to(event.target, .3, {alpha:.2});//alpha out the thumbnails
}
/*
**********************************************************************
THUMBNAILS SCROLLER
**********************************************************************/
//scrollable area
var scrollPaneX:int
var scrollPaneY:int;
var scrollPaneWidth:int;
var scrollPaneHeight:int;
var scrollTrackWidth:int;
var scrollSpeed:int = 12;
var holder_mc:Sprite = new Sprite();
var thumbMask_mc:Sprite = new Sprite();//mask for thumbs track
var thumbTrackBg_mc:Sprite = new Sprite();
function constructScroller():void {
holder_mc.x=scrollPaneX;
holder_mc.y = scrollPaneY*2+paddingY;
addChild(holder_mc);
//create mask sprite
thumbMask_mc.graphics.beginFill(0xFFFFFF);
thumbMask_mc.graphics.drawRect(0, 0, scrollPaneWidth, scrollPaneHeight*2+paddingY);
thumbMask_mc.graphics.endFill();
thumbMask_mc.x = scrollPaneX;
thumbMask_mc.y = scrollPaneY;
addChild(thumbMask_mc);
holder_mc.mask = thumbMask_mc;
thumbTrackBg_mc.graphics.beginFill(0xFFFFFF);
thumbTrackBg_mc.graphics.drawRect(0, 0, scrollPaneWidth, scrollPaneHeight);
thumbTrackBg_mc.graphics.endFill();
thumbTrackBg_mc.alpha=0;
thumbTrackBg_mc.x = 0;
thumbTrackBg_mc.y = 0;
thumbTrackBg_mc.width = scrollTrackWidth;
thumbTrackBg_mc.height = scrollPaneHeight;
holder_mc.addChildAt(thumbTrackBg_mc,0);
}
function addScrollListeners():void{
holder_mc.addEventListener(MouseEvent.ROLL_OVER,startScroll);
holder_mc.addEventListener(MouseEvent.ROLL_OUT, stopScroll);
}
function startScroll(e:MouseEvent):void{
thumbMask_mc.addEventListener(Event.ENTER_FRAME, scrollThumbs);
}
function stopScroll(event:MouseEvent):void{
thumbMask_mc.removeEventListener(Event.ENTER_FRAME, scrollThumbs);
}
function scrollThumbs(event:Event):void {
holder_mc.x += Math.cos((-thumbMask_mc.mouseX/scrollPaneWidth)*Math.PI)*scrollSpeed;
if (holder_mc.x>scrollPaneX) {
holder_mc.x = scrollPaneX;
}
if (-holder_mc.x>(holder_mc.width-scrollPaneWidth-scrollPaneX)) {
holder_mc.x = -(holder_mc.width-scrollPaneWidth-scrollPaneX);
}
}
Creating Multiple Images With Loop
Hi!
I am doing a school project where I need to create serveral objects in a loop. The objects should be stored inside an array. These objects are supposed to be images which I should be able to move, change, resize etc. I want the images to be loaded externally (images that are not inside the flashfile). Also I want to be able to change the images shown in each of these objects.
I have no clue how to do this. I am very thankful for all help I can get.
Creating Multiple Text Fields
I'm drawing a graph in flash, and I need to draw a scale.
Inside a newly created movie clip (using createEmptyMovieClip):
Code:
for(i=0; i<=sizeY; i+=yScale) {
createTextField("mytext"+i,2,0,i,30,15);
["mytext"+i].border = true;
myformat = new TextFormat();
myformat.color = 0xff0000;
myformat.underline = true;
["mytext"+i].text=i;
["mytext"+i].setTextFormat(myformat);
}
The problem seems to lie with ["mytext"+i]... I got that convention from an example on this website, except that it was something like _root ["mytext"+i]. But I do not wish for the text field to be in _root... it has to be in the current movie clip.
Any ideas?
Creating Multiple Textboxes During Runtime
I am trying to create multiple textfields during runtime using the createTextField method in my actions layer.
I've tried to create them all in a loop in one movieclip, but that was only displaying one textfield, so I figured it was a problem with the movieclip... so now I'm trying to create a movieclip for each textfield without overwriting any of my other movieclips...
Here's my code for the textfields and movieclips:
var pixelsx:Number=_root.cyclo._x+20;
var pixelsy:Number=_root.cyclo._y + 20;
var boxNumber: Number=1;
var depth:String;
var layer:MovieClip;
var my_fmt:TextFormat= new TextFormat();
my_fmt.color= 0xFFFFFF
do{
depth=this.getNextHighestDepth();
layer.createEmptyMovieClip(("magnetic"+depth), Number(depth));
layer["magnetic"+depth].createTextField(("label" + boxNumber), magnetic.getDepth(),pixelsx,pixelsy,30,30);
pixelsx=pixelsx+30;
layer["magnetic"+depth}["label"+boxNumber].setTextFormat(my_fmt);
layer["magnetic"+depth]["label"+boxNumber].text="X";
boxNumber++;
}while(pixelsx<(_root.cyclo._x+_root.cyclo._width));
I'm wondering what I'm doing wrong or if there is a better/easier way to create textfields with unique names at runtime.
Thanks
Problem Of Multiple Different-size Textfield
Hi all, I need ur help..
I need a profile page for people which is consist of one textfield for name and one textfield for workiing experience. Textfield dimension for name is smaller than for workiing experience. So , I need to make those two textfield (createTextField), then I make another those two textfield through loop. Cause, If I use script below I only make one textfield then loop it , meanwhile I need two different-dimension textfield and loop it.
code :
for (i=0;i<4;i++){
_root.createTextField("field"+i,i,350,70+(i*100),3 00,40);
_root.field.border = true;
_root.field.borderColor = 0xff0000;
_root.field.background = true;
_root.field.backgroundColor = oxFF0000;
}
|