Array Of Record (Delphi => ActionScript)
Have a var in Delphi:
c:array [0..90601] of record x,y:integer end; . . procedure Tform1.LgCub; var x,y:extended; ... for g:=0 to 90601 do begin j:=c[g].x;k:=c[g].y; x:=(k-150)*scala; y:=(150-j)*scala; natm:=0; ....
How can I declare the analog of it (c) in ActionScript? Thanks.
FlashKit > Flash Help > Flash ActionScript
Posted on: 02-19-2005, 03:41 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Array Of Record [Urgent Help Pls]
Hi there,
how to implement an "array of record" in flash?
Or is it supported?
my script:
//start
MyRecord = new Object();
MyArray = new Array();
for(var x = 1; x<=10; x++)
{
MyRecord.num = x;
MyArray[x] = MyRecord;
}
for (var x = 1; x<=10;x++)
{
trace(MyArray[x].num);
}
The output is not 1,2,3,4....10
why?
what's wrong?
Thx for help.
Some Form Of Record Array?
In Delphi (Object Pascal) I can create records (and object with accessible and creatable properties) and can also make this into an array, to have a Record Array, can this be done with AS2?
E.g.:
Code:
myRecord = Record()
{
name: string;
pn: integer;
}
myArray = Array [1..2] of myRecord;
myArray[0].name = "john";
myArray[0].pn = 25;
myArray[1].name = "peter";
myArray[1].pn = 36;
The above code somewhat resembles Object Pascal, but is just to show an example of what I mean. It is not perfectly accurate (op doesn't use { and } for example lol).
How To Delete A Single Record From My Array?
Hi there. How can i delete just one 'row' from my array?
Code:
var ThumbArray:Array = new Array();
ThumbArray[0] = ["70317", "name70317", "2"]
ThumbArray[1] = ["28076", "name28076", "3"]
ThumbArray[2] = ["28085", "name28085", "1"]
ThumbArray[3] = ["28006", "name28006", "3"]
ThumbArray[4] = ["28013", "name28013", "2"]
//when you click somewhere does this
var whichthumb = 3
//says to delete ThumbArray[3]
i tried to do like this, but it delete the record and everything after....
Code:
function btn_delete_handler(event:MouseEvent):void {
ThumbArray.splice(event.target.parent.whichthumb);
}
thanks for any help!
Two Demansion Array & Record Fields
1. How do I create 2 demasioned arrays in ActionScript with out
writing ar=new Array([0,0,0],[0,0,0]) in the beginning just like I do in Visual Basic[ Dim ar(1 to 5,1 to 3) as integer] or Pascal (ar:array[1..5,1..3]) of integer ?
2. How do I create records fields in ActionScript? just like it is in
Visual Basic as (Type..[fields as typename...End Type) or Pascal (Type=record..[fields as typename]..end)
Using An Array To Record Button Click Order
I am working on a demo of a UI for a handheld device. I am trying to make a back button that can track the users actions back several steps.
I started by putting this line of code in my frame 1 actions layer:
var wherefrom:Array = new Array();
then i placed this follwing code on several different buttons:
on(release){
wherefrom.push("frame_name1");
gotoAndStop("frame_name2");
}
then on the back button i added this following code:
on(release){
gotoAndStop(wherefrom.pop());
}
it doesnt seem to be working. I was wondering if this type of action is possible using AS2.0? any suggestions would be greatly appreciated.
Attach Code
var wherefrom:Array = new Array();
Record Function Audio Mixer -> Array Question
Hi, I'm building an audio mixer with diffrent loops you can mix, like loop labs etc. I want to create a record fuction but I'm still considering the best posible way to do this.
The easyest way for me would be to record all setting on every frame in an array. But the downside is that this would turn into a very lage one as there are about 6 tracks which each have 5 settings (pan, mute, solo, volume, trackno) and a master which would lead to about 30+ settings every frame.
My question would be: can you load 30 items in an array every frame at 30fps and what kind of strain would this give on a system if you would let that run for lets say 15 minutes?
Integration With Delphi
this is my first question, excuse-me.
how to integrate flash with delphi, such as:
press a button in a flash movie into delphi program, and start a delphi event.
thanks.
Flash + Delphi
Hello,
I got a problem with my program, I couldn't find how to send variables from Flash to Delphi! If anyone know how to do this, please HELP! Thanks.
Delphi+Flash
HI !
I've got a Delphi application. This app. use a flash(swf) file
with the ocx control(TShockwaveFlash).
How can I read or write a flash variable ?
Not the 'movie', 'BGcolor'.
I create a new variable in my flash. for example(mypet='dog')
and I want to change this variable to 'cat' if this contain 'dog'.
thank you
Macromed Flash File Not Running In Delphi
Hi all,
I'm a Delphi programer & I installed the tshockwave package from within delphi.
When I run flash movies created with swish (trial version), they run just fine (i.e xyz.movie := 'ddd.swf'; xyz.play;).
BUT
when I try the same with .swf movies made with macromedia flash, the movies do not appear to run, or atleast, I don't see anything happening.
(my swish trial period ranout, so I have to use flash!!).
Is there any setting from within the flash.fla file I should set? Is there another way to call a .swf movie made with flash?
Can anyone help me?
Yomi.
Actionscript Array Bug?
I think I found a bug in actionscript 2's array implementation. The following is solid according to flash's own documentation, however, it won't work. It only produces undefined results.
function convertToCartesian( r:Number, theta:Number ):Array
{
var cartesianPoints:Array;
cartesianPoints[0] = int(r * Math.cos(theta));
cartesianPoints[1] = int(r * Math.sin(theta));
trace( cartesianPoints[0] + ", " + cartesianPoints[1] );
return cartesianPoints ;
}
Has anyone else experienced something similar?
Array In ActionScript
I have a problem, just need to convert a code from Delphi into ActionScript, in Delphi is used an array like this:
Ar:array[1..300,1..300] of extended;
how to create that var in action script (bidimensional)? I was searching in many books but didn't find...
Thank you!
Array With Actionscript?
Can I include scripting in an array? Instead of going to an external link, I would like the link to execute a command in the movie, like:
links[1]=this._parent._parent.videoPlayer_mc.streamMedia(" videos/bounce10.flv", 10);
not
links[1]="www.actionscripts.org");
Actionscript And Array Problem...
Frustration == yes
this is a statistics project that allows the user to compile hypotesis testing equations. after both equations are filled, a check button appears, and is supposed to trace some information and then true or false.
the function checkMe() checks the x and y coords of each movie clip acording to variables such as pos1, pos2, and posy1, and posy2.
when the correct equations are entered, it only recognizes posistions 3,4,7, and 8 as correct (array slots 2,3,6, & 7). any help or nit-picking would be much appreciated.
for testing purposes, the correct equations are:
Ho : u <= u0
Ha : u > u0
the file can be downloaded here:
http://www.columbia.edu/~bmd36/flash/
I Suck With Actionscript:Array Help
Sup, I'm an ordinary BASIC programmer who is in high school converting over to flash then to C++...etc.
I need a fast array scanner that will duplicate several different movies if a different number is found (100x100 array). I got some ideas for the array searcher, but the code is longer than I think actionscript is capable of.
Right now the code searches line by line. But I'm thinking about making a seperate little script so that when it detects changes in variables, it inputs the number and the position of the variable change into another array.
Any help?
Help With Actionscript Array Increment
How can I set
code:
path.forward_btn.onRelease = function() {
and
code:
path.back_btn.onRelease = function() {
to only increment iSectionIndex no more than once per folio clip X horizontal slide. I"m having a problem where the array is advancing ahead of itself because you can just keep clicking the buttons. At least I think this is the issue.
code:
var aSectionTxt;
var iSectionIndex = 0;
_global.portfolioSection = function(a) {
targetX = 527;
path = _root.sectionMC_03.folioClip;
maxWidth = path.section_mc._width-529;
velocity = 4;
aSectionTxt = a.concat();
path.section_mc.initEnterFrame();
path.forward_btn.onRelease = function() {
if (targetX>-(maxWidth-370)) {
targetX -= 370;
//
var dir = 1;
if (iSectionIndex+dir>=0 && iSectionIndex+dir<=aSectionTxt.length) {
iSectionIndex += dir;
}
// iSectionIndex must be set here -- not at the end of the enterframe func.
path.section_mc.initEnterFrame();
}
};
path.back_btn.onRelease = function() {
if (targetX<527) {
targetX += 370;
//
var dir = -1;
if (iSectionIndex+dir>=0 && iSectionIndex+dir<=aSectionTxt.length) {
iSectionIndex += dir;
}
// iSectionIndex must be set here -- not at the end of the enterframe func.
path.section_mc.initEnterFrame();
}
};
};
MovieClip.prototype.initEnterFrame = function() {
path.section_txt.text = "";
if (mcMovieToRemove != null) {
removeMovieClip(mcMovieToRemove);
}
this.onEnterFrame = function() {
//trace("Running Enter Frame");
this._x += (targetX-this._x)/velocity;
if (this._x<(targetX+1) && this._x>(targetX-1)) {
//trace("Stopping Enter Frame");
this._x = targetX;
setSectionText();
delete this.onEnterFrame;
}
};
};
_global.setSectionText = function() {
if (typeof (aSectionTxt[iSectionIndex]) == "string") {
path.section_txt.text = aSectionTxt[iSectionIndex];
} else {
mcMovieToRemove = path.attachMovie(aSectionTxt[iSectionIndex].linkage, "mcSectionMovie", 10);
mcMovieToRemove._x = aSectionTxt[iSectionIndex].x;
mcMovieToRemove._y = aSectionTxt[iSectionIndex].y;
}
};
I think the key is to change...
code:
if (iSectionIndex+dir>=0 && iSectionIndex+dir<=aSectionTxt.length) {
iSectionIndex += dir;
}
to include...if iSectionIndex + dir >= 0 && iSectionIndex+dir<=aSectionTxt.length AND this._x EQUALS targetX... or something like that then it would work. I just need iSectionIndex not to increment while this._x is busy reaching targetX and then I think everything would work. Or like if targetX-this._x/velocity = 0 then iSectionIndex += dir.
Actionscript Help With Array Increment
How can I set
ActionScript Code:
path.forward_btn.onRelease = function() {
and
ActionScript Code:
path.back_btn.onRelease = function() {
to only increment iSectionIndex no more than once per folio clip X horizontal slide. I"m having a problem where the array is advancing ahead of itself because you can just keep clicking the buttons. At least I think this is the issue.
ActionScript Code:
var aSectionTxt;
var iSectionIndex = 0;
_global.portfolioSection = function(a) {
targetX = 527;
path = _root.sectionMC_03.folioClip;
maxWidth = path.section_mc._width-529;
velocity = 4;
aSectionTxt = a.concat();
path.section_mc.initEnterFrame();
path.forward_btn.onRelease = function() {
if (targetX>-(maxWidth-370)) {
targetX -= 370;
//
var dir = 1;
if (iSectionIndex+dir>=0 && iSectionIndex+dir<=aSectionTxt.length) {
iSectionIndex += dir;
}
// iSectionIndex must be set here -- not at the end of the enterframe func.
path.section_mc.initEnterFrame();
}
};
path.back_btn.onRelease = function() {
if (targetX<527) {
targetX += 370;
//
var dir = -1;
if (iSectionIndex+dir>=0 && iSectionIndex+dir<=aSectionTxt.length) {
iSectionIndex += dir;
}
// iSectionIndex must be set here -- not at the end of the enterframe func.
path.section_mc.initEnterFrame();
}
};
};
MovieClip.prototype.initEnterFrame = function() {
path.section_txt.text = "";
if (mcMovieToRemove != null) {
removeMovieClip(mcMovieToRemove);
}
this.onEnterFrame = function() {
//trace("Running Enter Frame");
this._x += (targetX-this._x)/velocity;
if (this._x<(targetX+1) && this._x>(targetX-1)) {
//trace("Stopping Enter Frame");
this._x = targetX;
setSectionText();
delete this.onEnterFrame;
}
};
};
_global.setSectionText = function() {
if (typeof (aSectionTxt[iSectionIndex]) == "string") {
path.section_txt.text = aSectionTxt[iSectionIndex];
} else {
mcMovieToRemove = path.attachMovie(aSectionTxt[iSectionIndex].linkage, "mcSectionMovie", 10);
mcMovieToRemove._x = aSectionTxt[iSectionIndex].x;
mcMovieToRemove._y = aSectionTxt[iSectionIndex].y;
}
};
Actionscript - TextField - Array
Hi,
I am trying to pull out the contents of an array ("category" in my case) and display it inside a textfield ("testText"). The elements of teh array should appear one after the other inside the textfield. I created a textField inside a movieclip and then was trying to animate the movieclip. But how do I change the contents of the text field? I tried something like the following, but the elements sweeps past so fast that only the last element of the array is visible.
this.onEnterFrame = function(){
for(var i:Number=0; i<category.length; i++){
testMovie.testText.text = category[i];
}
};
Any help is appreciable. Thank You.
Abi.
Actionscript Eval And Array[] Enigma
i stumbled into a little puzzler......
i am using the following actionscript:
_root.num_04="violet"
colorName = eval("_root.num_" + _root.menusArray[4][1] ) ;
_root.array1 = colorName;
_root.array2 = _root.menusArray[4][1];
set("_root." + colorName, []);
set("_root." + colorName + "[1]", _root.menusArray[4][1]);
set("_root." + colorName + "[2]", _root.menusArray[4][2]);
_root.array3 = _root.violet[2];
_root.array4 = eval("_root." + _root.num_04 + "[2]");
menusArray[4][1] holds a text value like "04"
menusArray[4][2] holds a text value like "Company"
[array1....array4 are just dyn text boxes to display values for debugging]
results of dyn text boxes:
array1 ==> [violet ] ...correct
array2 ==> [04 ] ...correct
array3 ==> [ ] .......nothin!
array4 ==> [Company ] ...correct
the question is......why no value showing up for array3?
its got something to do with how the definition of the array is constructed.....using 'eval'
i then added this line of actionscript to further understand what was happening.....
_root.violet[2] = "New Value";
after this addition......
array3 ==> [New Value ]
but....
array4 ==> [Company ] ...not affected!?!
so......
either the definition using 'eval' make the difference
or
the difference lies in the 'eval' used to define the final value....
...as in the diff betw....
_root.array3 = _root.violet[2];
and....
_root.num_04="violet"
_root.array4 = eval("_root." + _root.num_04 + "[2]");
any thoughts would be appreciated.
[Edited by howardroarklives on 04-09-2002 at 03:01 AM]
MX ActionScript Question, Array To Send XML
Hello!
In my flash movie, I have an array of data.. At the end of the movie, I want to take this array and have it in an XML object so that when the user clicks a certain button, that XML object is sent to a server-side PHP file. Could someone please help me with this ASAP??
Thanks,
Susanna
Weird Bug In ActionScript Envolving Array. Please Help.
I'm using Flash MX 6.0 and Flash MX 2004 Professional
Try this:
Code:
normal = new Array(01,02,03,04,05,06,07,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60);
Now check syntax.
It should appear "This script contains no errors".
Now try this:
Code:
normal = new Array(01,02,03,04,05,06,07,08,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60);
Now check syntax. It says ERROR.
Code:
Scene=Scene 1, Layer=ac, Frame=1: Line 3: ')' or ',' expected
normal = new Array("01","02","03",04,05,06,07,08,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60);
Scene=Scene 1, Layer=ac, Frame=1: Line 15: Unexpected '}' encountered
}
The only diference is that I have a "08" instead of "8" in the Array. Is that a Flash bug or an error in my code?
Thanks.
Actionscript 2.0 Dimentional Array Dilema
Not sure if this being AS2.0 matters:
I have a 2D array that i am shifting and pushing
basically I want to take the first row and put it in the back of the array
so 1,2,3,4
to 2,3,4,1
to 3,4,1,2
and so forth.
code:
var temp1:Number = _root.idArray[0][0]
var temp2:String = _root.idArray[0][1]
x = _root.idArray.length
function doArray(){
_root.idArray.shift();
//_root.idArray[0][0] = shifted
_root.idArray.push();
_root.idArray[x][0] = this.temp1
_root.idArray[x][1] = this.temp2
}
THIS doesnt work
i think my code for the push should look something like
_root.idArray.push({temp1,temp2})
but when compiled i get an identifier problem
HELP!!!!!
Pass Array From ActionScript To JavaScript
Hi, All:
Can anyone explain how to pass an array into JavaScript using the getURL function? Current code looks something like this, but it does not work:
getURL("javascript: myFunc(" + myArray + ");")
However, this call seems to produce this actual code in both IE and Firefox:
getURL("javascript: myFunc([object Object]);")
Both browsers choke on [object Object]. In Firefox, it explicitly thinks some other delimiter should appear around [object Object].
I searched the knowledge base and it says that arrays can be passed between JavaScript and Flash without any problem, so I am not sure exactly what we re doing wrong in this call. Any help would be appreciated. Thanks!
AJK
Actionscript: Storing Objects In An Array
bit of a programming question here :
I have a data object class in which I would like a property to be an array of objects , each with their own properties and methods. It seems that in actionscript , once put inside an array, an object loses its type - does anyone know if is there any way round this?
Would it be bad to just create a generic object for each array element and dynamically assign properties to it?
Adv Actionscript: Calling Functions From Array Or XML
The question is twofold. I've written a group of functions. I want to call the functions based off of entries in an xml file. So, XML 1 will call function 4. XML 2 will call function 1, etc...
What happens is this, the string in the xml file relates to a function in my actionscript, however Flash is only recognizing the string as a string, and not as one of the functions in my code. I've tried strict datatyping the xml text to a variable...
Code:
var functionname:Function = xmlNode.childNodes...nodeValue
I then push the variable to an Array, and call the element in the array on a button click. If I trace my variable, it has the same name as my function, but my function isn't running
...2nd part, Other languages have what's called "collections"...for example, when compiling in .Net, or a similar language, I can use a global "collection" reference to access any of the function written in the code. Does Actionscript have a similar reference? (not only for functions, but for say Movie Clips, images, sounds, etc)
thnx,
-j
Actionscript Movieclip Array Access
ok, so i have a MENU movieclip, which contains some button movie clips.
i create the movie clips using actionscript, and store them in an array (which is in fact just an array of strings that hold the mc identifiers).
I access these movie clips (in the MENU movieclip), by using
Code:
this[button_mc[i]].property
however, i can't seem to access them in a similar way in _root.
I would of thought it would be something like
Code:
_root[MENU.button_mc[index]].property, but no dice.
I could access the movie clips using the actuall string identifiers, but that gets rid of the niceness of using the array.
Why does flash suck in this way?
Actionscript also sucks. I spend so much time debugging spelling mistakes in my variable names.
But yeah, flash is ace.
Links To Html Files In An Actionscript Array
I am a noob to flash! I downloaded a flash component from flashden and I am trying to edit it to suit my needs. I am able to change everything i need to except add links to other html pages in my site in the array in actionscript.
Can someon eplease help me?
Here is my code:
//The script for the button effects
import SubBtn;
//script for fade transitions
import caurina.transitions.Tweener;
/***********************************
Hello,
Thanks for buying this menu.
So how do you implement this menu?
1. change the paramenters bellow to suit your needs
(the paramenters which should be changed is marked)
2. if you are using this menu as part of a bigger project
you have to copy the external classes into your project directory
(that is the entire folder caurina and the class SubBtn.as)
3. in the _menuItemsAndContent array in the change variables
section beneath you should put in a name of the
menu item along with an MovieClip accosiated with that item. So when the item
is clicked you can retrieve that mc.
another way to change the content would be to listen to the item id
and determin what to show according to that. Then not accosiate any MovieClip
and just leave the mc as a null.
alternatively you can listen for the name of the item.
if you dont what to accosiate the item with a MovieClip just put in null as
I did in the sample.
4. When an item is clicked the function onSubMouseClick is called and
you should determin what to happen, as this is only a menu!
So go to the onSubMouseClick function bellow the change variables section
and see how to retrieve the items' data when they are clicked.
Cheers
***********************************/
/***********************************
--> CHANGE VARIABLES SECTION
***********************************/
var _spacing:int = -2; //the spacing of the menu items
var _btnAlpha:Number = .6; //the alpha of the menu items
var _overColor:String = "#f2a800"; //the over hex color
var _outColor:String = "#878a7c"; //the "not" over hex color
//there are currently 5 items in the menu
var _menuItemsAndContent = new Array({name:"Home", mc:new MovieClip}, //name and mc, leave mc empty if you don't use it
{name:"about us", mc:null},
{name:"portfolio", mc:null},
{name:"services", mc:null},
{name:"contact us",mc:null});
/***********************************
END OF CHANGE VARIABLES SECTION
***********************************/
function onSubMouseClick(event:MouseEvent):void {
//here are the the 3 methods that can be used to change the content
//returns item id/it's position in the _subBtnsAndPos array
trace("id " + event.currentTarget.name);
//returns the items name
trace("name " + _subBtnsAndPos[event.currentTarget.name].name);
//return the MovieClip that has been accosiated with the item or null
//if you haven't use that feature
trace("MC " + _subBtnsAndPos[event.currentTarget.name].mc);
}
/***********************************
THE PART OF THE SCRIPT
WHICH SHOULD BE CHAGED STARTS HERE
***********************************/
var _subMenuYPos:int = openMenu.y + openMenu.height + _spacing + 0;//pos of the items
var _subBtnsAndPos:Array = new Array();//the sub items and their data
var _subsHolder:Sprite = new Sprite();//holds all items
var _isOpen:Boolean = false;//to see if the menu is opened or not
addSubMenues(_menuItemsAndContent);//call the addSubMenues which creates the items
_subsHolder.alpha = _btnAlpha;//uses the alpha from change variables section
openMenu.buttonMode = true;
//ads events
openMenu.addEventListener(MouseEvent.ROLL_OVER, onOpenMenu);
_subsHolder.addEventListener(MouseEvent.ROLL_OUT, onCloseMenu);
//OPEN MENU
function onOpenMenu(event:MouseEvent):void {
tweenOutSubs("in");//the function which tween the items in and out
}
//CLOSE MENU
function onCloseMenu(event:MouseEvent):void {
tweenOutSubs("out");
}
function tweenOutSubs(type:String):void {
if(type == "in") {
if(!_isOpen) {
//if the items are not visible they are tweened
//on to the stage, by looping through the _subBtnsAndPos array
_isOpen = true;
for(var i:int; i < _subBtnsAndPos.length; i++) {
_subBtnsAndPos[i].object.alpha = 0;
_subBtnsAndPos[i].object.visible = true;
Tweener.addTween(_subBtnsAndPos[i].object, {y:_subBtnsAndPos[i].pos
,alpha:1, time:1, transition:"easeOutQuart"});
}
}
}
else {
//the same thing but now they are tweened out
_isOpen = false;
for(var o:int; o < _subBtnsAndPos.length; o++) {
Tweener.addTween(_subBtnsAndPos[o].object, {y:0,time:.5, alpha:0, transition:"easeOutQuart"});
}
}
}
//ADD SUB
function addSubMenues(arr:Array):void {
//the sub items are created with the addSubMenu function
for(var i:int; i < arr.length; i++) {
addSubMenu(arr[i].name, arr[i].mc);
}
var maxWidth:int;
for(i = 0; i < _subBtnsAndPos.length; i++) {
if(_subBtnsAndPos[i].object.width > maxWidth){
maxWidth = _subBtnsAndPos[i].object.width;
}
}
//adding hit area
var appHit:Shape = new Shape();
appHit.graphics.beginFill(0xCC0000,0);
appHit.graphics.drawRect(0, 0, maxWidth, _subMenuYPos + _subBtnsAndPos[_subBtnsAndPos.length-1].object.height);
appHit.graphics.endFill();
_subsHolder.addChildAt(appHit,0);
removeChild(openMenu);
_subsHolder.addChild(openMenu);
addChild(_subsHolder);
}
function addSubMenu(name:String, mc:MovieClip):void {
//call to SubBtn (external class) which deals with the mouse over effects
var sub:SubBtn = new SubBtn(_overColor, _outColor, name.toLowerCase());
sub.addEventListener(MouseEvent.CLICK, onSubMouseClick);
sub.name = String(_subBtnsAndPos.length);
sub.visible = false;
//the item is pushed into the _subBtnsAndPos array so they can be
//retrieved later on
_subBtnsAndPos.push({object:sub, pos:_subMenuYPos, mc:mc, name:name.toLowerCase()});
_subsHolder.addChild(sub);
//adds to the menu height to possition the next button bellow this one
_subMenuYPos += sub.height + _spacing;
}
Actionscript Compare Two Arrays And Create New Array
I have two arrays which contain something like:
array_one = (a->b, b->c, c)
array_two = (a, b, b->c, c)
and I want to concatenate these (I can do that) but remove duplicates. So at the moment I have:
array_three = (a->b, b->c, c, a, b, b->c, c)
whereas I want it to be:
array_three = (a->b, b->c, c, a, b) the order doesn't matter.
Can someone show me how to do this please? I think I either need to compare each element before concatenation, or somehow remove duplicates afterwards?
[F8] Setting Array Keys Dynamically In Flash Actionscript
I'm creating an array object in ActionScript. I need the keys AND the properties of those keys to be dynamic.
Here is a hard-coded example:
MyArray[0].Title = "This is the title"
...but I want the key ("Title" in this example) to be dynamic. Here's how I would think it could work:
index_num = 0
prop_name = "Title"
eval("MyArray["+ index_num +"]."+ prop_name +") = "This is the title!"
...but that doesn't work.
How do I do this??
Thanks in advance!!!
Creating Multi-Dimensional Delimited Array In ActionScript
Hi, I haven't even gone so far as to try any kind of prototyped idea of this as I just do not want to get myself bogged down on any wrong route, as from past experience, I don't want to waste a weeks worth of time and hair.
here's the problem.........
I am currently poulating a Flash production for a client with XML generated data, simply so that I can give my client a piece of work which they themselves can update easily. The problem comes from the fact that I could have quite a lot of information hanging around in the form of a multi dimensional array structure where the XML data will be placed after parsing.
Ideally I would like the ability to create a delimited Multi-dimensional array, which can dynamically update it's size, without me having to declare an array of 32000 cells each time, which could waste system resources to a stupid proportion.
any help with this would be appreciated.
I have tried:-
Code:
_global.myArray = new Array();
but it didn't seem to initialise the array unfortunately....
Tanks!!!
[Flash8] Actionscript - Passing Array Variables By Value Not Reference
It took me hours to figure our why this was returning the wrong value - when assigning one array to another it passes by reference not Value. I need a way to force it to pass by values. e.g. copy the existing array and have the second array reference it, so i am free to modify the first array without changing the values of the second
// CODE Sample - show that array assignment = passing by reference.
function one(){
var test1 = Array();
test1["one"] = 1;
var test2 = test1;
trace(test2.one); // output = 1 // this make sense because it gets the value from test1
test1.one = 1000;
trace(test2.one); // output = 1000 // !!!! this should be 1 === passed by reference. If by value this would be independent from test1.one
}
one();
/// end CODE SAMPLE
From the example above You see that in Actionscript when assigning one variable to another it does it my reference not value. So when you chage the value of one array it changes the value of the other automatically.
I need to have the "test2" variable reference the "test1" array only by value so if modify "test1" the values of "test2" won't be modified.
If this is a setting to change this or a way to have the variable reference only by value this would be extremely helpful.
Thanks
KJ
Loading XML Child Nodes Attributes In A Array In Flash Actionscript
hi guys .i want to load all the attributes by the name "pagename" within this xml file into an array : my_array
pls help.
xml file:
Code:
<?xml version="1.0" encoding="UTF-8" ?>
- <earnvaluemanagement>
- <module id="01" title="Overview" foldername="content/module_01">
- <chapter id="01_01" title="Introduction">
<page id="01_01_01" title="Introduction" pagename="m01_c01_p01.swf" />
<page id="01_01_02" title="Introduction" pagename="m01_c01_p02.swf" />
<page id="01_01_03" title="Introduction" pagename="m01_c01_p03.swf" />
<page id="01_01_04" title="Introduction" pagename="m01_c01_p04.swf" />
</chapter>
</module>
- <module id="02" title="Earned Value Management Concepts" foldername="content/module_02">
- <chapter id="02_01" title="Overview">
<page id="02_01_01" title="Overview" pagename="m02_c01_p01.swf" />
<page id="02_01_02" title="Overview" pagename="m02_c01_p02.swf" />
<page id="02_01_03" title="Overview" pagename="m02_c01_p03.swf" />
<page id="02_01_04" title="Overview" pagename="m02_c01_p04.swf" />
<page id="02_01_05" title="Overview" pagename="m02_c01_p05.swf" />
<page id="02_01_06" title="Overview" pagename="m02_c01_p06.swf" />
</chapter>
- <chapter id="02_02" title="Framework of EVM System">
<page id="02_02_07" title="Framework of EVM System" pagename="m02_c01_p07.swf" />
<page id="02_02_08" title="Framework of EVM System" pagename="m02_c01_p08.swf" />
<page id="02_02_09" title="Framework of EVM system" pagename="m02_c01_p09.swf" />
<page id="02_02_10" title="Framework of EVM system" pagename="m02_c01_p10.swf" />
<page id="02_02_11" title="Exercise" pagename="m02_c01_p11_exercise01.swf" />
<page id="02_02_12" title="Exercise" pagename="m02_c01_p11_exercise02.swf" />
<page id="02_02_13" title="Summary" pagename="m02_c01_p12_Summary.swf" />
</chapter>
</module>
- <module id="03" title="Scope of the Project: Work Breakdown Structure" foldername="content/module_03">
- <chapter id="03_01" title="What is WBS?">
<page id="03_01_01" title="What is WBS?" pagename="m03_c01_p01.swf" />
<page id="03_01_02" title="Preparing a WBS" pagename="m03_c01_p02.swf" />
</chapter>
- <chapter id="03_02" title="Preparing a WBS">
<page id="03_02_03" title="Preparing a WBS" pagename="m03_c01_p03.swf" />
<page id="03_02_04" title="Preparing a WBS" pagename="m03_c01_p04.swf" />
<page id="03_02_05" title="Preparing a WBS" pagename="m03_c01_p05.swf" />
<page id="03_02_06" title="Preparing a WBS" pagename="m03_c01_p06.swf" />
</chapter>
- <chapter id="03_03" title="WBS and Earned Value">
<page id="03_03_07" title="Preparing a WBS" pagename="m03_c01_p07.swf" />
<page id="03_03_08" title="Preparing a WBS" pagename="m03_c01_p08.swf" />
<page id="03_03_09" title="Exercise" pagename="m03_c01_p09_exercise01.swf" />
<page id="03_03_10" title="Exercise" pagename="m03_c01_p09_exercise02.swf" />
<page id="03_03_11" title="Exercise" pagename="m03_c01_p09_exercise03.swf" />
<page id="03_03_12" title="Summary" pagename="m03_c01_p10_summary.swf" />
</chapter>
</module>
- <module id="04" title="Plan and Schedule the Project" foldername="content/module_04">
- <chapter id="04_01" title="Understand and Plan The Project">
<page id="04_01_01" title="Understand and Plan the Project" pagename="m04_c01_p01.swf" />
<page id="04_01_02" title="Understand and Plan the Project" pagename="m04_c01_p02.swf" />
</chapter>
- <chapter id="04_02" title="Schedule the Project">
<page id="04_02_03" title="Schedule the Project" pagename="m04_c01_p03.swf" />
<page id="04_02_04" title="Schedule the Project" pagename="m04_c01_p04.swf" />
<page id="04_02_05" title="Schedule the Project" pagename="m04_c01_p05.swf" />
<page id="04_02_06" title="Exercise" pagename="m04_c01_p06_exercise01.swf" />
<page id="04_02_07" title="Exercise" pagename="m04_c01_p06_exercise02.swf" />
<page id="04_02_08" title="Summary" pagename="m04_c01_p07_summary.swf" />
</chapter>
</module>
- <module id="05" title="Estimate and Budget Project Resources" foldername="content/module_05">
- <chapter id="05_01" title="Why Budgeting?">
<page id="05_01_01" title="Why Budgeting?" pagename="m05_c01_p01.swf" />
<page id="05_01_02" title="Why Budgeting?" pagename="m05_c01_p02.swf" />
<page id="05_01_03" title="Why Budgeting?" pagename="m05_c01_p03.swf" />
</chapter>
- <chapter id="05_02" title="Earned Value CAPs (Control Account Plans)">
<page id="05_02_04" title="Earned Value CAPs (Control Account Plans)" pagename="m05_c01_p04.swf" />
<page id="05_02_05" title="Earned Value CAPs (Control Account Plans)" pagename="m05_c01_p05.swf" />
<page id="05_02_06" title="Earned Value CAPs (Control Account Plans)" pagename="m05_c01_p06.swf" />
<page id="05_02_07" title="Earned Value CAPs (Control Account Plans)" pagename="m05_c01_p07.swf" />
<page id="05_02_08" title="Exercise" pagename="m05_c01_p08_exercise01.swf" />
<page id="05_02_09" title="Exercise" pagename="m05_c01_p08_exercise02.swf" />
<page id="05_02_10" title="Summary" pagename="m05_c01_p09_summary.swf" />
</chapter>
</module>
- <module id="06" title="EVMS Concepts and Methods" foldername="content/module_06">
- <chapter id="06_01" title="EVMS Criteria">
<page id="06_01_01" title="EVMS Criteria" pagename="m06_c01_p01.swf" />
<page id="06_01_02" title="EVMS Criteria" pagename="m06_c01_p02.swf" />
</chapter>
- <chapter id="06_02" title="EVMS Basic Terminology">
<page id="06_02_01" title="EVMS Basic Terminology" pagename="m06_c02_p01.swf" />
</chapter>
- <chapter id="06_03" title="Earned Value Methods">
<page id="06_03_02" title="Earned Value Methods" pagename="m06_c02_p02.swf" />
</chapter>
- <chapter id="06_04" title="Project Status">
<page id="06_04_03" title="Project Status" pagename="m06_c02_p03.swf" />
<page id="06_04_04" title="Exercise" pagename="m06_c02_p04_exercise01.swf" />
<page id="06_04_05" title="Exercise" pagename="m06_c02_p04_exercise02.swf" />
<page id="06_04_06" title="Summary" pagename="m06_c02_p05_summary.swf" />
</chapter>
</module>
- <module id="07" title="Monitoring Performance Against the Baseline" foldername="content/module_07">
- <chapter id="07_01" title="Performance Measurement">
<page id="07_01_01" title="" pagename="m07_c01_p01.swf" />
<page id="07_01_02" title="" pagename="m07_c01_p02.swf" />
</chapter>
- <chapter id="07_02" title="Variances and Performance Indices">
<page id="07_01_03" title="" pagename="m07_c01_p03.swf" />
<page id="07_01_04" title="" pagename="m07_c01_p04.swf" />
</chapter>
- <chapter id="07_03" title="Estimate at Completion">
<page id="07_01_05" title="" pagename="m07_c01_p05.swf" />
<page id="07_01_06" title="" pagename="m07_c01_p06.swf" />
<page id="07_01_07" title="" pagename="m07_c01_p07_exercise01.swf" />
<page id="07_01_07" title="" pagename="m07_c01_p07_exercise02.swf" />
<page id="07_01_08" title="" pagename="m07_c01_p08_summary.swf" />
</chapter>
</module>
- <module id="08" title="Integrated Baseline Review and Change Control" foldername="content/module_08">
- <chapter id="08_01" title="Integrated Baseline Review">
<page id="08_01_01" title="" pagename="m08_c01_p01.swf" />
<page id="08_01_02" title="" pagename="m08_c01_p02.swf" />
</chapter>
- <chapter id="08_02" title="Change Control">
<page id="08_01_03" title="" pagename="m08_c01_p03.swf" />
<page id="08_01_04" title="" pagename="m08_c01_p04.swf" />
<page id="08_01_05" title="" pagename="m08_c01_p05.swf" />
</chapter>
- <chapter id="08_03" title="Cost Performance Report">
<page id="08_01_06" title="" pagename="m08_c01_p06.swf" />
<page id="08_01_07" title="" pagename="m08_c01_p07.swf" />
<page id="08_01_08" title="" pagename="m08_c01_p08.swf" />
<page id="08_01_09" title="" pagename="m08_c01_p09_exercise01.swf" />
<page id="08_01_09" title="" pagename="m08_c01_p09_exercise02.swf" />
<page id="08_01_010" title="" pagename="m08_c01_p010_summary.swf" />
<page id="08_01_010" title="" pagename="m08_c01_p011_course_summary.swf" />
</chapter>
</module>
- <module id="09" title="Assessment" foldername="content/module_09">
- <chapter id="09_01" title="Assessment">
<page id="09_01_01" title="" pagename="assessment.swf" />
<page id="09_01_02" title="" pagename="Thank_you.swf" />
</chapter>
</module>
Record Mp3 With FMS
Hi!
I'm trying to record .mp3 file with FMS. I can save .flv with my webcam (video+audio) but i'd to save audio only files in .mp3 format using only my microphone.
I just use netStream.publish(myFileName, "record") to save my files. I've tried netStream.publish("mp3:myFileName", "record") but it doesn't work. May i have tu create a directory different from /myapp/streams/_definst_/ to record mp3?
Thanks in advance! Any help will be useful and appreciate!
M.
Keep Record
Hey...
I would like to know hot to create a "Top List"
Like MASTER 64 has on his avatar...
Will someone help me?
How To Record An SWF?
I'd like to put some motion graphics up on youtube, however I don't have a clue about video, I've never dabbled in it. In fact I've never even uploaded a video to youtube
So could anyone tell me how this is done and what tools I need?
I essentially just want to run an SWF and record/encode it live to an avi or mpg.
Cheers,
Joe
Keep Record
Hey...
I would like to know hot to create a "Top List"
Like MASTER 64 has on his avatar...
Will someone help me?
How To Record Drawing
Hello! The concept of Flash is to use keyframes to set a start- and endpoint of a motion and then "tween" the move between them.
I would like to show a movie, in which something is painted with the point-tool. When doing this and playing the movie, you only could see the result of the painting. Is it (somehow) possible to record the drawing itself, so that you could see how the picture is drawn? I mean that the user sees, how the picture is created.
Martho
Record My Voice
I would like to know how I can add a my voice to a flash movie.What software do I need to create a wav file of my voice.Thank you.
How To Record Sounds.?
Hi Ppl,
does neone hv a component or is aware of a method which enables sound recording thru a microphone in Flash?
Please let me know ASAP
Regs
Make A Mix, Record?
ok ive a mixer:
www.dj-ni.now.nu
click on mix
its a bti basic at the moi, but u get the idea, i was just windering is there anyway that if a user makes a mix they san record it? or save it?
u know like, www.looplbas.com or http://www.bacardidj.com/
?? cheers
Screen Record Help?
Hi there
Anyone know of a good screenrecording tool with swf export that don't cost so damn much? I've seen camtasia and roboDemo, but there got to be a cheaper tool that those?? Please help
tnx
DSpawn
Move To Next XML Record
Hi!
I have an XML file data-binded to some UI components (Labels).
Now I need "Next" and "Previous" buttons to move through the XML records.
How can I do this?? Do i just apply some actionscript to a button??
Thanks!
Need Something To Record My Actions.
Not sure where to post this message, thought I'd try in here first.
I have developed a few interactive CD's.
I need to have them played and 'interacted' automatically.
I can write some code for this, but wanted to know if there was something out there that could help.
I've looked up Captivate on Macromedia.
Not sure if this will do the job.
It certanly records mouse actions, which is what I need.
The only problem is that my work, when clicked, may run at different speeds.
So a mouse click on location (x, y) after X seconds may not always have the desired results.
Any help would be appreciated.
Thanks.
OM
[F8] Help...trying To Animate A Record Box
I am trying to animate a dj record box, but i do not know how to go about it.
I want to use the record box a menu, so the user selects diffrent records to get to different sections.
I have a jpeg of an empty record box and a and a full record box.
can any one give me any ideads of how i could do this?
thanks in advance
[F8] Can Record Voice In F8?
i need to record voice and re-play it
this is what i did ... i think the voice is recorded, but i do not know how to play it
Code:
on (release)
{
System.showSettings(2);
client_nc = new NetConnection();
client_nc.onStatus = function(info) {
trace("Level: " + info.level + newline + "Code: " + info.code);
}
client_nc.connect("rtmp:/voice_message/room02");
rec_so = SharedObject.getRemote("recordings", client_nc.uri, false);
rec_so.connect(client_nc);
var active_mic:Microphone = Microphone.get();
out_ns = new NetStream(client_nc);
out_ns.attachAudio(active_mic);
out_ns.publish("Anwar", "record");
client_nc = new NetConnection();
client_nc.connect("rtmp:/voice_message/room02");
out_ns = new NetStream(client_nc);
function doPlay (){
if (Play_btn.getLabel() == "Play") {
in_ns = new NetStream(_root.client_nc);
in_ns.play("Anwar.flv");
}
}
}
any help
[F8] Random Record From XML?
Hi,
Iv got loads of movieclips that fall downwards then jump up to the top again and carry on falling, when the user clicks on one of the clips i would like to display a random text record from an XML file; is this possible using AS2?
Can I Record Sound?
This does not have to be done over the net, yet. But what I want is for the user to push a button and talk into a microphone. They should be able to record about 20 seconds of sound. I plan to have this in some sort of array tied to the frame number. But all I need to do now is get sound to record through a .swf file when a button is pushed.
What do you think?
|