how can i link to another flash movie form one flash movie? i am working on psychometric stats project, and I want to save the state of the graphs (which are made so that they are draggable) while they link to another swf file. any sugggestions would be highly appreciated.PEACE
with mc2 inside mc1, an action from a button in mc2, to container_mc (sitting on mc1 timeline), would be - on(release){ _parent.container_mc.loadMovie("a.swf"); }
thanks loopkit! i have two swf files where one can drag the graphs up and down and sideways. what i wanted to do is, when i drag the graphs, and they overlap, and then i hit the navigation button to go to another swf, i want that overlapping state of the graph to continue on the other swf too. is there any suggestion? i would appreciate it! take care!
give buttons and clips sequential names, btn0,btn1...mc0,mc1,mc2... and loop through them - for(var n=0; n!=27; n++){ this["btn"+n].onRelease=function(){ this["mc"+n].play(); }; } or hold the button and clip instance names in arrays and loop through the arrays, aBtns = ["btnA","btnB","myC2",......]; aClips = ["clipnames",....]; for(var n=0; n!=aBtns.length; n++){ this[aBtns[ n ]].onRelease=function(){ this[aClips[ n ]].play(); }; } hth
thanks for your reply. I decided to try the arrays option. Unfortunatly I couldn~t get it working and I found that the [aClips[ n ]]. array element returns undefined once the OnRelease method is executed in the script so it is unable to refernece the array element. Any ideas why the array elements to the movieClips cannot be accessed inside the onRelease method?
I've atached a sample fla with 20 buttons, using the array code.
very interesting, thanks alot. I must say, steam starts coming out of my ears when I try to figure out why it works. Rather than just steal your code I want to learn how it works. 1 for statement inside another is enough to cause a short circuit in my brain! cheers MD
an example usage of the code place 5 buttons on stage, hold their instance names in an array add arrays to hold buttons selected and button positions add a selection button, instance - selection_btn, click a few buttons to load aSelect array, watch the trace then press selection_btn to start showBtns() function allBtns = ["btn0","btn1","btn2","btn3","btn4"]; aSelect = []; aPos = []; for(var n=0; n!=allBtns.length; n++){ aPos.push(this[allBtns[ n ]]._y); this[allBtns[ n ]].onRelease=function(){ aSelect.push(this._name); trace(aSelect); }; } function showBtns(){ for(var x=0; x!= allBtns.length; x++){ this[allBtns[ x ]]._visible = false; //hide all } for(var y=0; y!= aSelect.length; y++){ this[aSelect[ y ]]._y = aPos[ y ]; this[aSelect[ y ]]._visible = true; //show selection and position } }; selection_btn.onRelease=function(){ this._visible = false; showBtns(); }; hth
It is not possible to save xml from flash directly to an xml file - you must use other technologies (such as coldfusion and such like). You can, however, save an xml document to a local shared object for the flash swf file to use again later if needed. The other option is to write the XML to a textbox on stage, then copy and paste the xml into a text file..... not very elegant but it works!
thanks Jack. I cant really get my head around your last example. I am still very intererested in your previous example which I have adopted slightly here: MyBtns = ["But1","But2","But3"]; MyClips = ["Mov1","Mov2","Mov3"]; for(var n=0; n < 4; n++){ this[MyBtns[ n ]].onRelease=function(){ trace (MyClips[ n ]); this[MyClips[ n ]].play(); }; } This code is simple enough for me to get my head around. The only problem is that after the onRelease line is run, "n" looses its value and returns undefined. The wierd thing is. If you trace the whole array, it traces Mov1,Mov2,Mov3 no problem. Can anyone understand why? I have attached an example file with 3 buttons and 3 movs. MD
This is in the macromedia docs. You can also use the XUpdateResolver component to send data updates to any external data source that can parse the XUpdate language?for example, an ASP page, a Java servlet, or a ColdFusion component. For more information, see the XUpdate specification at www.xmldb.org/xupdate/. But the URL does not work anymore. Does anyone have an example of a php or jsp file that reads the xml file that the xmlConnector is using and with a post or remoting call to the file can update the data? Thanks! wade
Hi Mike, here's a (working;) method, apols for earlier code :( this splits the button name to a temp array, assigns variable - num to the numeric element, and using this._parent, scopes out of the button function to the clips on the main timeline, as arrays index from zero, you need But0 / Mov0 MyBtns = ["But0","But1","But2","But3","But4"]; MyClips = ["Mov0","Mov1","Mov2","Mov3","Mov4"]; for(var n=0; n < MyBtns.length; n++){ this[MyBtns[ n ]].onRelease=function(){ aTemp = this._name.split("But"); num = aTemp[ 1 ]; trace(MyClips[ num ]); this._parent[MyClips[ num ]].play(); }; } hth
Hey Jack, thats wonderful it works! Trying to understand how it works, aTemp = this._name.split("But"); Am I right in thinking that this._name.split("but") this means this instance _name means name of this instance ("but") is the part of the name it is extracting. It stores the result in aTemp num = aTemp[1] here you are transfering aTemp[1] to num I guess that the [1] is the element number right? I cant understand this part as it seems that the element number is always number 1 so thought it would always call the Mov[1] (which is actually Mov2) no matter which button I press. thanks for your help MD
Jack, Thank you so much! I knew it'd be something fairly simple! I really cannot thank you enough. The site will go live next Tuesday at www.CMP2004.com if you're interested in taking a look. Many thanks again, ~ Elliot
Hi Jack, Actually, I still have a small problem Although the movies are loading in, they appear to be distorted. I'm using pixel fonts and they appear blurred in places. I've checked everything is set to the '0.0' reference points on every movie clip, but I'm still getting the problem. Could it be to do with my container MC? The MC consists of a one-pixel-thick rectagle with no fill. However, even if I remove the rectangle, I still have the problem. The rectangle / MC exactly matches the dimensions of the external ..SWFs, and I've tried changing the dimensions... to no avail. Any ideas? ~ Elliot
say you select But0, the looped code will read this as - But0.onRelease=function(){ aTemp = this._name.split("But"); // split But0 @ But // aTemp[ 0 ] = But // aTemp[ 1] = 0 num = aTemp[ 1 ]; // num = 0 trace(MyClips[ num ]); // returns Mov0 this._parent[MyClips[ num ]].play(); // Mov0 will play }; to see how Flash holds these variables, when you use Test Movie, from the menu select List Variables this will show what elements aTemp is holding. hth
Got it, thanks Jack. I?ve only been using actionscript for a few weeks, hence, my understanding of it is at a basic level. Didnt know about split or even how to get to the instance name. thanks for your help (again!), Mike
I had the same problem with the list component. Try this. It should work _global.styles.ScrollSelectList = new mx.styles.CSSStyleDeclaration(); _global.styles.ScrollSelectList.setStyle("backgroundColor","null");
Don't see what you're looking for? Try a search.
|