Assigning Mc Instances In MX
I am having a problem with assigning onRelease action to different instances of the same mc. For some reason the same code just does not work with one of the instances.
The two instances are called 'tab1' and 'atab1' of the 'tab' mc. 'tab1' is on frame 1 of the _root and 'atab1' is on frame 2 of the _root.
The following code does exactly what it's supposed to:
Code: _root.tab1.onRelease=function(){ gotoAndStop(2); gotoDock(); aFade1(); loseVis25(); };
But the next code does not work:
Code: _root.atab1.onRelease=function(){ gotoAndStop(1); }
The instance atab1 on frame 2 has no button capability - the cursor does not even change when over it.
As you can see all I want the mc instance to do is return the _root to frame 1 of the timeline.
Anyone see what I am doing wrong?
Cheers
Charco
FlashKit > Flash Help > Flash ActionScript
Posted on: 07-19-2008, 05:52 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Assigning Actions To Instances
Within the movie explorer, how do I assign actions to the instance I have dragged onto the stage? I have assigned actions to the first frame, but I need to know how to assign actions to the object I have dragged into the frame. Thanks for the help.
Assigning Vars To MC Instances
Last edited by Bernie X : 2002-03-02 at 09:23.
More insight:
A button obj action calls the function sceneSwitch and passes a param of scene01 to the function.
For example:
on(release){
sceneSwitch(scene01);
}
function sceneSwitch (my_scene) {
if ( my_scene==_root.scene_01) {
my_scene=_root.scene_01;
my_scene._alpha=100;
// doesn't wrk
}
}
For whatever the case may be, I can't seem to sub the param for the actual MC instance in the expression to chg its alpha. So, basically....
The expression 'my_scene._alpha=100;' doesn't work.
If I use 'scene_01._alpha=100;' that works. Any suggestions?
Please advise.
BX
Assigning Same Action To All Instances Of A Button?
Hi.
I have two buttons used extensively throughout my project. The actions for the buttons always stay the same.
Button 'a' will always be:
Code:
on(release)
{
prevFrame();
}
Button 'b' will always be:
Code:
on(release)
{
nextFrame();
}
Without assigning these same actions to every single instance of the button, is there any way to assign an 'on release' action for every instance of a button to do the same throughout the movie? Just saves me repetition of code.....and time....
Thanks.
Making Instances And Assigning Variables
Hi.
Sorry to ask so many questions but;
I made a sprite, simple enough. Now I want to give the sprite 2 variables and I can't figure how to do it!
My sprite is essentially a button, with a shape and textfield instances inside it. I have got an eventListener to check if the mouse is over. If it is, it calls a function which makes another eventListener Event.ENTER_FRAME on the sprite instance to animate the shape instance inside it. But for the animation to work I need these two variables to be given to the sprite instance. But when I try to do somthing like this;
Code:
var p = buttonCreate("cool",100,10,5);
addChild(p);
function buttonCreate(txtT,wT,hT,extT) {
var a = new Sprite();
a.curExt = 0;
a.maxExt = extT;
var b = new Shape();
a.addChild(b);
var t = new TextField();
a.addChild(t);
a.addEventListener(MouseEvent.MOUSE_OVER,buttonOver);
return a;
}
It doesnt want to give it the curExt or maxExt variables. I understand that you have to make a variable with the var keywork in AS3 before it works but how do you do it externally from the instance itself?
Thanks for reading/helping,
Dan
Also how should I store an identifier to the shape instance on the sprite? Because for the animation to work I am going to need to reference to it...
Assigning Event Handler Code To Button Instances
Hi
I'm trying to assign separate code to each instance of a button that I am attaching to a movie.
I'm going along the lines of:
code:
largeimgurl = "photos/large" + thumbfilename[i];
hots = "hotspot" + thumbnumber;
this["thumbnailholder" + thumbnumber].attachMovie("hotspot",hots,this["thumbnailholder" + thumbnumber].getNextHighestDepth()); //attach button
this["thumbnailholder" + thumbnumber][hots].onRelease = function()
{
_root.mainImage.loadMovie(largeimgurl);
}
The above code is in a loop. However, it doesn't seem to be working - e.g. when I test the movie the same image loads in mainImage no matter what button I click. Thanks for your help.
Assigning Loader Instances To Multiple Container Clips
I have a project where I am loading in a variable quantity of photos and then assigning them to a finite amount of containers.
I have 18 containers, and I can have between 1 and 18 photos. So if I have 1 photo it should be placed in all 18 containers, if I have 2 they should each go in 9 containers.
Right now I am loading in the photos successfully but I am having issues making them children of the multiple containers.
Here's the relevant code
Code:
private function RenderPhotos():void
{
Globals.Debugger.text = "";
this.mcContainer.gotoAndStop(1);
var singleTimer:uint = 10; //Number of seconds for one photo animation.
var numPhotos:uint = URLList.length; //Number of photos
var numPlaces:uint = this.mcContainer.numChildren; //Number of slots for photos
var count:uint = 0;
for(var i:uint = 0; i < numPlaces; i++)
{
if(count > (numPhotos - 1))
{
count = 0;
}
if(PhotoList[count].content)
GetHolder(i).addChild(Loader(PhotoList[count]).content);
else
Globals.Debugger.text += "was null -- ";
count++;
}
this.mcContainer.play();
}
This method is called by the Event.COMPLETE event handler, so the content is there. This code will display the photo ONCE, in the last container it was assigned to, but I need to assign it to multiple containers...
I tried using a "duplicateMovieClip" method from a third party but it doesn't seem to support Loader too well. Anyone have any ideas?
Can Instances Be Attached To Instances ?
can instances be attached to instances using attach movie??
what i am doing is creating an instance of a movie by dragging and dropping and attaching a movie to a symbol and then i want to attach my new movie instance that i just created to another instance... can i do that...??
thanks
Assigning
I am a rookie in actionscripting and have a problem. I have a movie that has 60 frames. I also have 3 buttons. I would like to make it so button 1 jumps 2 frames consecutively (each press) through the movie. Button 2 jumps 10 frames apart through the movie, and button 3 jumps 20 frames,etc. Can someone tell me what actionscripting I can use to accomplish this?
Thanks .....HELP!!!!
Assigning MC's Same AS's. OOP?
Ok, so im fooling around with duplicating MCs and trying to "give them all a script" taking me off to OOP, something ive only looked at slightly when fooling with c++ and java.
anyway, my problem is, I do not know if I am at all close to doing this correct, Ive looked at the tutorials on this, but for some reason I do not get it to work, maybe I didnt understand the tutorials or soem old c++/java stuff is still in my head screwing it up.
So, to get a better idea you can perhaps look at; http://jamietelin.mine.nu/web/flashTest/tictactoe.swf
I manage to build up my "field" (9 boxes, 3*3), by duplicating and positiong it all with a loop, then i want all these MC's to have the same onClick event for example. So I though, OOP.
But OOPS! (joke) it didnt work. becuse, well I guess I dont know what I am doing.
ActionScript Code:
boxClass = function () {
this.onPress = function() {
trace("ok");
};
};
boxClass.prototype = new MovieClip();
x = 145;
y = 75;
line = 1;
for (i=2; i<=9; i++) {
if (line == 3) {
y += _root.box._height;
x -= _root.box._width*3;
line = 1;
} else {
line++;
}
x += _root.box._width;
Object.registerClass("box"+i, boxClass);
_root.box.duplicateMovieClip("box"+i, i);
_root["box"+i]._x = x;
_root["box"+i]._y = y;
}
Suggestions? guidelines? a good easy example? anyhelp and I am forever thankfull. Take care!
Assigning Targets But...HELP
ok so i have 2 movie clips...one of the movies clips contains a graphic which contains a button inside of it...i want that button to control the other movie clip (the one that it is not inside of) it is named "pictures"...so i added this code to the button:
on (release) {
tellTarget ("pictures") {
gotoAndStop (2);
}
}
so i run the movie in the flash preview and click on the button and a little window comes up telling me this:
Target not found: Target="pictures" Base="_level0.instance20"
...am i doing something wrong...please help me out, i've been trying to figure this out for hours...
thanks,
james
Assigning Actions
im trying to figure out a way to put on clip event actions on an attached movieclip using the with action.is there another way to do this?
Assigning More Than One Value To A Variable
Hello All. I am doing this order form that has loads of input text fields for people to fill in quantity. The text fields all have unique variable names. They are sent to a php script in the end that then sends it to someone via email. Here is my problem. I need to be able to calculate the total amount in dollars in the end so the user can ok it. Can I assign a variable more than one value? Could I make the variable leather_belts = what the user types in in the input text field (quantity)as well as a dollar amount? Any help is greatly appreciated!
Assigning A Url To A Button
I read this http://www.macromedia.com/support/fl...up_windows.htm
I want my window to popup a button.
I know how to assign a url to a button. Such as my site at http://people.txucom.net/kicker
But I want a click from the new window to open the second button.
can someone read this webpage at macromedia and tell me how to assign a window to a button. I want the window to be clicked and a new button to show. Right now the first button goes to the searchbox that if you type a search term you get a window from clicking on the new window, I want a second button to appear.Down the Line
I want the same effect as http://www.bonus4u.da.ru
Getting An MC Name And Assigning A Variable?
How would one do this:
I'm setting an MC to a color via myColor = new Color();
However I am don't know how to get access to the color as a variable?
myColor as a variable keeps displaying [object Object]
I'm not a coder - any help would be of value
Thanks!
Assigning A Variable?
hey there...
i'm having a problem either assigning a variable the correct way, or my 'if' statement isn't set up right.
for example, if button 'xxx' is pressed, i want the variable 'test' to = 1, if button 'yyy' is pressed, i want the variable 'test' to = 2... and so on...
now, if 'test' = 2, goto and play label 'yyy'
it's not working?!?!?
check out my sample too...
thanks!!!
adam.
Assigning Value Of A Varible
Hi All,
I am trying to assign some variables value which are placed on the main stage
lets say
var1, var2,.........., varN
_level0.varN
On the main movie another movie is loaded which has some movieclips, whoes shape and color values are changed with the users input (by clicking on the buttons) even can uload the movie but if he further loads the movie he should get the same (last view). There are about 100 such movies and movie clip.
I am saving a varible to store that.
but when I want to reset these variables
lets say
_level0.varN = 1
for(i=1; i<=myMCvar.length; i++)
{
var setVAR = eval("_level0.var"+i);
//default value is
//I want to set it to 2
//I tried this way
trace (setVAR);//output is 1;
setVAR = 2;// but this doesn't work ...
trace (setVAR)//output is 2;
trace (_level0.varN);//but the output is 1, where as I want it to be 2
}
Can Any one Help me in This..
Bids
Assigning MC.onPress
I'm trying to assign MovieClips.onPress dynamically with a loadMovie function, but can't get it to work.
Here is my script below.
Xml is something like this:
<sectionNode>
<navPageNode urlFile="1stPage">Blah</navPageNode>
<navPageNode urlFile="2ndPage">Blah2</navPageNode>
<navPageNode urlFile="3rdPage">Blah3</navPageNode>
</sectionNode>
for (var z=0;z<numNavPages;z++)
{
var navPageNode = sectionNode.childNodes[z];
var urlAttrib = navPageNode.attributes.urlFile + ".swf";
eval("_root.tMC"+z).onPress = function()
{
_root.loadMovie(urlAttrib);
}
}
what happens here is that all the movieClips.onPress gets assigned "3rdPage.swf"
thanks.
Assigning Variables
Is it possible to declare and assign a variable o a movie clip using actionscript from the _root?
For example, if I wanted to assign variable "x" to the movieclip "BlueBox", will the following code work? If it will, I haven't been able to do it so far.
ex. var x;
BlueBox.x = 5;
Thanks in advance for your answer(s),
Josu
Assigning Buttons ?
HELP !!!! I'll explain my problem. I have 5 buttons all in the same keyframe ie contact, clients, experience etc, if the user clicks on say contacts the movie then plays for 1.5 seconds while the buttons move to another place. the movie then jumps to a html page made in dreamweaver due to an action on the last keyframe of the movie. how can a make it so the movie will jump to the html page corresponding to the button ie contact.html or clients.html. when i click on a button it always goes to the same html page ???????
Assigning Levels
I have two movies, main.swf and content.swf. Main.swf has a container_mc that content.swf will load into. Content.swf has a text area (component). When I test content.swf it works fine, but when I test main.swf and enter the frame that loads content.swf the text area does not show the text. The text area is visible along with the other graphics on content.swf, but no text in the text are shows up.
I'm pretty sure this has to do with loading content.swf into a level above main.swf. So my question is this... how do you assign a level? And where does the code need to be placed?
Thanks for the help.
Help Assigning Variables
I have a MC (called movieContainer_mc) that holds an instance of movie_mc. I've duplicated the movie_mc to make a holder for each movie that is being dynamically loaded from a text file. What I need to do is make all those duplicated MCs have an on.release function that will send the clip id to a 'swapMovie' function and will then change out the movies. Here's what I have in the maintimeline so far:
Code:
for (var i = 0; i < movies_array.length; i++) {
movieContainer_mc.movie_mc.duplicateMovieClip("movie"+i+"_mc", i);
newClip = eval("movieContainer_mc.movie"+i+"_mc");
newClip.idNum = i;
trace("movie"+i+"_mc has been made");
}
and on the timeline of the movie_mc
Code:
var idNum;
this.onRelease = function () {
_root.swapMovie(idNum);
trace(this + " has been clicked
ID Num = " + idNum);
};
I'm not quite sure if this is the right syntax for assigning variables to MC's , so any suggestions are welcome. Thanks!
Assigning Different Sounds
hi guys,
i am creating a racing game in flash and have got everything working fine appart from one last thing that i want to add....
i would like to add some sounds to the game, such as when the car is accelerating a sound of acceleration is played and when the car is braking deceleration etc... Can this be done? if so can someone help please
thanks
John
Please Help...assigning Classes?
I'm simply duplicating by attaching movie and I need the attached movie to take on the class...but it isn't working...
Any ideas?
================================================== ==
function dup(instance_name) {
_root.holder_mc.attachMovie(instance_name+"_mc",in stance_name+"_mc"+count, count);
count++;
new_instance = instance_name+"_mc" + count;
with (hands){ // hands are in hands movieclip
trace("after: " +new_instance)
//TRYING TO DYNAMICALLY ASSIGN IT BUT NOT WORKING
new_instance.onPress = function(){ this.addFreeTransform(); }
}
Thanks fitchic
=)
Assigning OnRelease To A MC?
I try to assign a function to a MovieClip which holds a image.
When playing the movie, the images are shown, but the buttons are not working. What's wrong?
My code:
code:
pic = _root.attachMovie("picItem", "picItem"+j, j);
pic._x = 100*j;
pic._y = 0;
pic.loadMovie(get_property("archive_"+lala+"_galle ry", "thumbnail", j));
pic.onRelease = function() {
play();
Assigning N= Value To Buttons
Hi,
Can anyone tell me exactly how to assign an "n=?" value to a button? Here's what I'm trying to do:
-I have several buttons on a layer. With the first click of a button, an mc slides out, leaving it in an open state.
-Clicking one of the other buttons needs to FIRST close the already open mc before sliding out the next mc.
I've set it up this way:
- Each button has a gotoAndPlay value which slide-closes the currently open mc like so:
Code:
on (release) {
gotoAndPlay("close01");
}
(this is the closing part... now I need to open the next mc)
Thanks for any help.
Assigning Variables
I'm building a site.
Basically it consists of the loader, which loads the background and the user interface. The loader is on level 1, the background on level 0, and the user interface is on level 2. Basically this is how the site is structured. What I want to do is get the stage width of the user interface. There are a few things that I did, but I had to disable the strict mode from the publish settings, but I want to be able to keep it on, because for debugging issues. How do I get the width of the movie clip which is the user interface, but not the stage root, I want to do it within the user interface, or externally thru the loader. In a way that I don't need to turn of the strict mode off.
[CS3] Assigning Variables?
I am building a portfolio section to my site. I want to load this external file and then be able to navigate to different areas of the time line to show different things. One big need is for there to be a seamless transition between each item. How can I use one variable that is declared by the arriving object to target for the next transition.
Example:
enter the frame of new object (object slides left w/ease)
variable is declared on its time line.
Click to go to next object.
variable is referenced and old object is told to slide to "x"
Varible is cleared.
next object slides left w/ease and sets same variable again.
Have had no luck establishing variables. HELP!
Name Property Not Assigning
can anyone tell me why this doesn't assign the name property to my clip:
PHP Code:
var clip: CSClip = new CSClip();
clip.name = "slider";
this.target.addChild(clip);
trace(this.target.slider);
the CSClip is an exported library clip, there is no class file associated with it, just whatever blank package flash automatically generates
also, is there a best practise when referencing clips to reference them by instance name or class instance?
thanks
Assigning Values
I am relatively new to flash and just found this website. My question is, is it possible to assign different point values in a quiz. For example, if I ask a question and give 5 choices for answers I need each answer worth a different point value. Like answer #1 worth 1 point, #2 worth 2 points and so on. Is this possible? If so is there a tutorial that will teach me how to do this?
Thanks
Assigning Colours
Hey guys, I love Joshua Davis' work, and am trying to learn how he does it. For those that do not know him: www.joshuadavis.com
He uses flash to generate art, and he does some beautiful work.
Specifically I'm trying to learn http://diary.joshuadavis.com/?page_id=43
and how he uses var mycolor and assigns random colors to the grey tones.
Any ideas? I've attached an image of what I've done.. I've got a blank mc which chooses random images from the library and places them in a circle. But I cant figure out how to colour the images on the fly too.
So I've got up to the bit where the images are placed randomly(within limits) on the stage, now its just the color..
I was thinking either one shade of grey would be a random colour each time, or i wouldnt really care if each shade of grey became something different.
Anyone know how it is done?
Thanks,
E
Assigning Color From Other Mc
I searched for this but couldn't find an answer......
First of all, I just enterered the AS this week. I'm starting a new website and said to myself, this time i'll have to use AS. Right now, I'm learning everything through flash help docs, forums and tutorials, but somethings i simply can't solve, though i try...
I have sucessfuly made in 3 frames, animations etc that used to take me hundreds.. so i'm very happy with AS, and just want to learn more and more!!
Right now, I have a file that has 15 different mc's.
When you click one mc, it should grow, and be on top of everyone else. then you click a "back" button, and it goes back to his place. I know I have to use swapDepths and things like that, altough I still didn't manage to sucessful finish this task...
But what now prevents me to continue is another thing.
Let's say, I have some common buttons, that appear to any mc clicked before. But those common buttons should perform acording to which mc was "chosen".
for me to see it, I'd like for a mc to have the same colour has another object in the film...
So, my question is...
I want to assign a mc with the coloranother mc has. I tried things like setRGB, getRGB, some variables... but I'm new at this, and still can't understand how everything works..
If you can provide me some help I'd be glad. Thanks.
Assigning Constants To Var
hi everyone.
I'm working on a website.
the problem i'm facing is the transition from main page to other pages.
basically, after a link is clicked from main page, it plays the animation within the swf file and then loads external swf that is appropriate for the link.
I'm trying to do so using a Boolean as false by default and i want to assign it the true value when the button is clicked.
my code at the moment is as follows :
-----frame 1
stop();
var eventClick:Boolean=false;
-----button script
on(release){
_root.gotoAndPlay(2);
eventClick=true;
}
----- last frame of _root timeline
stop();
if (eventClick==false){
trace("false");
} else {
trace("true");
}
i know that the button script is not assigning the true value to the eventClick var but i don't know how to overcome that.
your help is appreciated as always.
thanks, Victor
Assigning As Array Name To A MC
HI all,
I may be doing this the hard way. I have an array with the names of MCs in it. Every time I click a button I want to play the current MC in the array and then advance to the next one in the array so next time I click it plays that next one.
I works until I try to assign the name in the array to be the name of the MC I want to play. What I have here returns [object MovieClip]
Code:
var clipArray:Array=new Array("one_mc", "two_mc","three_mc", "four_mc");
var playClip:MovieClip=new MovieClip;
var thisClip:String=new String;
var i:int=0;
forward_btn.addEventListener(MouseEvent.CLICK, forward);
function forward(evt:MouseEvent):void {
thisClip=clipArray[i];
this[thisClip]=playClip;//THIS IS PROBLEM AREA
playClip.play();
if (i<clipArray.length) {
i=i+1;
}
}
thanks so much
Assigning Slider
hi friends
i try to assign a multiple SWF's Frames into single slider. when i drag and change on the slider . it should play smoothly the current swf's frame. whether is it possible in the flash.please anybody help me....
Thanks and Regards
Karthick Raj.S
Assigning A Value To A Textbox In A MC
With FlashVars I have got a text string into my movie
param name="FlashVars" value="lessonname=This is Lesson 1">
This is now on the main timeline.
I now need to get the string in to a textbox located in a MC.
Here is what I have
lessonMC.lessonHolder = lessonname;
lessonHolder is the name of both the instance of the textbox and the variable it contains.
Any ideas on why this doesn't work.
Or better
How do I assign the value of lessonBox to lessonname?
Problem Assigning Value
hello,
I have a problem assigning a value to var x
var x;
xmldoc = new XML();
xmldoc.ignoreWhite = true;
xmldoc.load("news.xml");
xmldoc.onLoad = function (succes){
if(succes){
trace("OK");
variableDemo()
}
else{
trace("Problem ");
}
}
function variableDemo( ){
_root.x = 10; // Nonlocal variable, x, is now 10
trace(x);
}
trace("x out "+_root.x); // Displays: undefined
if I use:
var x;
function variableDemo( ){
_root.x = 10; // Nonlocal variable, x, is now 10
trace(x);
}
variableDemo( )
trace("x out "+_root.x); //Displays: 10
when variableDemo( ) is used within onload event
xmldoc.onLoad = function (succes){
if(succes){
trace("OK");
variableDemo()
}
...............
there is no value assigned to x why not?
Problem Assigning Value
hi..
i have a small problem (maybe).. i tried so many time and i just cant figure out how. here is the situation:
this code i put at button to assigning value to attachedMC which have dynamic text(tetxto1,2,3....).
if(questionNumber==(1)){
_root.scroll1.tmp_mc.texto1.text = radioGroup.getValue();}
if(questionNumber==(2)){
_root.scroll1.tmp_mc.texto2.text = radioGroup.getValue();}
if(questionNumber==(3)){
_root.scroll1.tmp_mc.texto3.text = radioGroup.getValue();}
if(questionNumber==(4)){
_root.scroll1.tmp_mc.texto4.text = radioGroup.getValue();}
if(questionNumber==(5)){
_root.scroll1.tmp_mc.texto5.text = radioGroup.getValue();}
it working perfectly , all the value filled in.. but if i back to any previous question and choose other radio button, the value is not update... still with old value.
anyone have idea or solution for this?? plss..
thanks so much
aly
Assigning Data
OK, lets see if I can explain this correctly.
I have a move clip called 101.
I have...
ActionScript Code:
onClipEvent (load) {
loadVariables("you.php", this, "GET");
}
assigned to 101. Inside of 101 I have dynamic text fields with the var names of price, fee, and state.
I have a movieclip 102 that is exactly like 101. What I need to know is, how can differentiate 101 from 102 so that when the MySQL db data comes in that 101 and 102 display different info?
Also, I can't change the var names. They must stay as price, fee, and state in both movieclips.
Please give me a hand with this, it is very urgent. If you need more info please ask. Thanks!
Assigning Variable An Mc Name ?
okay here's what i have:
Code:
on(release){
if(this.newposition!=1){
positionclicked=this._x;
trace(positionclicked);
trace(_root.movieclip1);
_root.movieclip1.flyTo(positionclicked, 178, 2.4,1);
this.flyTo(145, 178, 2.4,1);
this.newposition=1;
_root.movieclip1="pink";
}
}
right now this code is on my mc's that make up my navmenu. the idea is that if you click one it will swap places with the first one in the sequential order of the menu. everything traces fine, but where I have:
Code:
_root.movieclip1.flyTo(positionclicked, 178, 2.4,1);
is where it's hiccuping (not doing anything)...
as you can see I'm trying to evaluate which mc is in the first position by using the movieclip1 variable and setting its value to the instance name of my mc... so that when you click a menu item it swaps places with that first mc. make sense? arrggghh!!!!
Assigning Buttons
I am trying to assign the Over keyframe of a button to fade in a .fal document ( a picture ). I have been looking everywere in the manual and help for somthing on button keyframes and have found very little. Could someone point me in the right direction on button keyframes and there abilty to trigger movies to play, pictures with effects to fade in our out, and animations to start and stop.
Thank you,
Milton
ps. what word does macromedia use for ( trigger / launch / command ect...)
Assigning The 'Enter' Key?
Hello there,
I've created a form using Flash and would like to make it so that the users of the form can simply hit the 'Enter' key and their data submitted; instead of having to click the 'Submit' button.
Thanks in advance,
Kristopher (UK).
Assigning Values To Mc:s
Hello again!
I have created a MC which will be duplicated many times and it contains a textbox and a button. Its like a node
I would like to some more variables to each copy of the mc, like name, number,current x, current y, and so on which is unique for just that mc.
How can i do this for every MC and be able to access the information from anywhere on the Stage?
Assigning XML Text
Hi,
Having issues getting the XML text assigned to the proper fields. "Undefined" is being returned. Any help would be appreciated.
Code:
//Create XML Object
var aquentDoc:XML = new XML();
aquentDoc.ignoreWhite = true;
//event handler
aquentDoc.onLoad = function(success:Boolean):Void {
if (!success) {
trace("Failure Loading aquentDoc XML");
return;
}
//validating the xml file
if (this.status != 0) {
trace("This xmlObject is not well-formed: "+this.status);
return;
}
//Error check - xml data okay!
if (this.firstChild.nodeName.toLowerCase() != "aquentdoc") {
trace("Unexpected XML data: "+this.firstChild.nodeName);
return;
}
//Extract elements into an array.
var elements_arr = this.firstChild.childNodes;
for (var i = 0; i<elements_arr.length; i++) {
//trace(elements_arr[i]);
if (elements_arr[i].attributes["id"] != null) {
var headers = elements_arr[i].attributes["id"];
//trace(headers);
assignText();
} else {
var content = elements_arr[i];
//trace(content);
}
}
};
//Load the document
aquentDoc.load("./aquentDoc.xml");
Code:
function assignText():Void {
for (var p in this) {
if (this[p] instanceof TextField) {
//Show each field's name
//trace("found "+this[p]._name);
if (this[p]._name == "header01_txt") {
header01_txt.text = elements_arr[0].attributes["id"];
} else if (this[p]._name == "header02_txt") {
header02_txt.text = elements_arr[1].attributes["id"];
} else if (this[p]._name == "header03_txt") {
header03_txt.text = elements_arr[2].attributes["id"];
}
}
}
}
Problem With Assigning Value
Hi,
the following script brings me a problem:
w = this["ha", "hb", "hc", "hd" ];
w.onPress = function() {
myClip._visible = true;
}
How to assign to variable "w" values from the square bracket that are separated by comas to be assigned either one of them and not only the last value "hd". In this case whichever value is pressed makes myClip visibility true.
Is this understandable?
fla file attached.
Thanks
For Loop And Assigning I
i'm trying to use a for loop to create 219 movie clips and have it assign the value i to each one.
this is how the movie clips are named on the stage
rollover1_mc, rollover2_mc, rollover3_mc and so on.
heres the for loop i was trying:
Code:
for(i=0; i<220; i++){
rollover + i + _mc.onRollOver = displayContent;
}
doesn't seem to be working.
basically i need it to repeat so i creates the following lines of code:
rollover1_mc.onRollOver = displayContent;
rollover2_mc.onRollOver = displayContent;
rollover3_mc.onRollOver = displayContent;
etc, etc
Any pointers?
Assigning Keypress... Please Help
Hi there,
I just want to ask some advise on how to change the directional arrows to keyboard letters on keypress. the browser scrolls when i press arrow up and down arrows and it's quite annoying. i just want to change the keypress of up arrow to w, then left arrow to a, right arrow to d and down arrow to s. just one of any will do then i'll do the rest.
here's the code:
function detectKeys() {
var ob = _root.char;
var keyPressed = false;
if (Key.isDown(Key.RIGHT)) {
keyPressed = _root.moveChar(ob, 1, 0);
} else if (Key.isDown(Key.LEFT)) {
keyPressed = _root.moveChar(ob, -1, 0);
} else if (Key.isDown(Key.UP)) {
keyPressed = _root.moveChar(ob, 0, -1);
} else if (Key.isDown(Key.DOWN)) {
keyPressed = _root.moveChar(ob, 0, 1);
}
// walk animation
if (!keyPressed) {
ob.clip.char.gotoAndStop(1);
} else {
ob.clip.char.play();
}
}
thanks a lot!!!
Assigning Values To Mc:s
Hello again!
I have created a MC which will be duplicated many times and it contains a textbox and a button. Its like a node
I would like to some more variables to each copy of the mc, like name, number,current x, current y, and so on which is unique for just that mc.
How can i do this for every MC and be able to access the information from anywhere on the Stage?
|