Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Putting A Variable Inside A CDATA Tag?



So I need to create an XML node that has CDATA wrapped text in it (so flash can read back the html tags). Can this be done if the if the text I'm trying to wrap with the cdata tags is a variable. Basically I'm trying to write a node that looks like this;<node><![CDATA[<u>my text</u>]]></node>but I need "<u>my text</u>" to be a variable.



Actionscript 3.0
Posted on: Wed Feb 27, 2008 6:42 pm


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

How To Write Variable To XML Node And Wrap It In CDATA
Is there any way to write a variable to an XML node and wrap that variable in CDATA tags?

For example, if I have a var _someVar, writing it into an XML node is easy; <myNode>{_someVar}</myNode> . But what happens when I want to wrap that variable in CDATA tags? I've tried everything I can think of. Can someone help?

Putting One Movie Inside Another
I was wondering if it is possible to create a flash movie in one part of the screen, so as to allow zooming on only that part. For example, I have a map on the upper left portion of the movie. On the right I have several buttons, and at the bottom there are descriptions and links. I want the user to be able to zoom in on the map portion without having the buttons and descriptive text be zoomed in also. Does anyone know of a way to do this?

I thought that it might not be possible using just Flash? Is that right? Will I have to use Dreamweaver in conjunction? I would much prefer to do it solely in Flash.

Thanks in advance.

Putting A Movie Clip Inside Another
okay, I made a scrolling text box fla called scroll. I want to put the text box inside my fla called info. How the heck do I do that? I know its simple, please take pity and help!

Putting A Command Inside A Graphic
I'm sure this has already been asked, but I did search for it and was unable to find the answer.

With that said, I was wondering how to put an actionscript that commands a specific graphic to do something rather than the whole movie.

For example, if I had a graphic that had three frames, and I wanted there to be a button that, when clicked, proceeded to Frame 2 in the GRAPHIC, how would the actionscript be? When placing the button inside the graphic, I put the actionscript


Code:
on(release){
gotoAndStop(2);
}
But what this does is go to the second frame in the whole movie. How would I make it so it went to the second frame in the graphic?

Thanks for your help.

Putting A Game Inside One Big Movieclip
I'm using the script below on a movie clip that moves and interacts with other movie clips. the movie clip the script is applied to is on it's own keyframe on the timeline in the main scene. now, i want to put everything i just made (the movie clip the script is applied to and the movie clips it interacts with) into one big movie clip so i can easily put it on a flash based website. I'm pretty sure the "_root." has to be changed but I'm not quite sure what to change it to







Attach Code

onClipEvent (load) {
power = .35;
radius = 7.5;
yspeed = 0;
xspeed = 0;
friction = 0.95;
gravity = 0.1;
thrust = 0.75;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
if (!_root.wall.hitTest(_x-9, _y, true)) {
xspeed -= power*thrust;
}
}
if (Key.isDown(Key.RIGHT)) {
if (!_root.wall.hitTest(_x+9, _y, true)) {
xspeed += power*thrust;
}
}
if (Key.isDown(Key.UP)) {
if (!_root.wall.hitTest(_x, _y-9, true)) {
yspeed -= power;
}
}
if (Key.isDown(Key.DOWN)) {
if (!_root.wall.hitTest(_x, _y+9, true)) {
yspeed += power;
}
}
if ((_root.wall.hitTest(_x, _y+9, true)) or (_root.wall.hitTest(_x, _y-9, true)) or (_root.wall.hitTest(_x+9, _y, true)) or (_root.wall.hitTest(_x-9, _y, true))) {
_root.play();
}
if ((_root.win.hitTest(_x, _y+9, true)) or (_root.win.hitTest(_x, _y-9, true)) or (_root.win.hitTest(_x+9, _y, true)) or (_root.win.hitTest(_x-9, _y, true))) {
_root.gotoAndPlay(13);
}
xspeed += gravity;
yspeed *= friction;
_y += yspeed;
_x += xspeed;
}

Putting A Tree Inside Of A Datagrid
I need some help putting a tree inside of a datagrid.  Any help would be appreciated.  Thanks!

Putting Buttons Inside Loaded SWFs
Hi,

Ok here's the situation:

I've got a host file into which I'm loading SWFs into a target.

I need to put buttons in the SWF but the entired loaded movie seems to act like a button i.e. the hand comes up as soon as I float the mouse over the target area.

I've tested this outside my project and I works. The button is hot and does what its supposed to do. However in my completed project I get the problem above.

Does this have to do with the publish settings?

c.

Putting An Animation Inside A Button Symbol.
How do you make it so when you rollover a button the "over" sequence is a animation of the button shrinking?

Putting Components Inside A ScrollPane Component
This is just wonderful - the Flash 8 Actionscript Bible shows this cool scrollPane with components inside of it and then doesn't tell the reader how to accomplish such a thing.

Since the scrollPane only allows for 3 types of content: movie clips, external swfs and jpegs, to get another component inside of one, I assume I have to put it inside a movie clip, and set it to export at runtime, right?

Putting Waveform Data Inside Of A Movie Clip
Hi guys,

How would you go about putting waveform data from a sound file inside of a movie clip so I can position it on the stage? I'm pretty sure this code is wrong, and I'm using the code from Lee's tutorial:

var holder:MovieClip = new MovieClip();

holder.x = 1000;
holder.y = 200;

var s:Sound = new Sound(new URLRequest("shift.mp3"));
s.play(0, 1000);

var ba:ByteArray = new ByteArray();

holder.addEventListener(Event.ENTER_FRAME, loop);

function loop(e:Event):void
{
graphics.clear();
graphics.beginFill(0x000000);
graphics.moveTo(-1, 150);
SoundMixer.computeSpectrum(ba);
for(var i:uint=0; i<256; i++)
{
var num:Number = -ba.readFloat()*200 + 150;
graphics.lineTo(i*2, num);
}
graphics.lineTo(512, 300);
graphics.lineTo(0, 300);
graphics.lineTo(-1, 150);
}


addChild(holder);

I tried creating the movieclip, positioning it, and adding it to the display list but it doesn't work. Any suggestions?

Thanks.

Alex

Putting Clickable Thumbnail Buttons Inside Scroll Movieclip
Hey everyone,

I have this problem with my image gallery in Flash MX 2004.
I try to put clickable thumbnails vertically inside a Scroll Movieclip.

When the images are not yet converted to symbol Movieclip, but are just buttons
they work fine. But problem is that my scroll doesn't work of course because this scroll needs to scroll the thumbnails, but before i can do that i have to convert the thumbnails to Movieclip. As soon as i convert them together to Movieclip they stop working but i can scroll now.

Could anyone please please tell me how to make it both work? Thanks so much. I added the .FLA file so please help me out thank you!

FLA file: http://members.lycos.nl/infernalmajesty/gallery.fla

Putting Variable In As Scene Name
Hi,

I'm trying to put a variable pulled from an array element into the scene section of a gotoAndPlay function.

Has anybody done anything like this before?? Currently, all it does is tell me that I anything I put in the Scene parameter must be enclosed in quotes.....

I've tried using eval() but to no avail....

Please help...!

Putting A Variable In #include
im trying to dynamically open a file dependant on a variable IE

i=1;

#include ["file"+i+".as"];

and flash hates me. is there ANYWAY to dynamically include a file?

also as a second question, is the a #include like command that will continue running if the included file is not found?

thanks

Putting A Variable Into A URL In Flash
Hi,

I originally posted this on the Scripting and Backend forum but got no response.

I am sure this is a quick fix. But could use some help.

I am pulling a bunch of variables from a php page. from those vairables i want to import a jpg image corresponding to that variable, like:

story_id = 1

so, first of all, I would want to pull "1.jpg" to correspond to that story.

How would I do this?

Second, in addition to that i will have a correspponding url for the person to click on so i want to add this same variable to the end of a URL.

Please help.

thanks.

Putting [] In A Variable Field
I have an array that says

myArray = new Array("one","two","three");

I have a dymanic text field with a variable called 'myArray[1]' - but it doesn't display it

The only way I can get the text field to display an item in the array, is to create another variable

newVar = myArray[1] - calling the text field newVar

Is there a way of displaying this with creating a new array?

Thanks a lot

Putting A Variable In A String
Hi, can anyone tell me how to put a variable in the middle of a string.
For example, for a text box to read:

Hello (name), welcome.

Thanks

Putting Your Variable Into The Get_url()
Hey all,

i have a var that was imported through php and i would like to add this to the get_url tag on a button.

Basically i have the variable myVar on the main timeline

and on the button i want to put something that should be like

I Totally made up this on release code but i think it will help explain


ActionScript Code:
on (release) {
getURL("issue.php?page=[._root.myVar]");
}

hope this is a simple question, i am mostly a php guy but learning as slowly slowly slowly..

thanks.

Loading Swf And Putting In There A Variable
What's wrong with this code, becouse it's loading the swf but it's not transfering the variable to it. :

ActionScript Code:
onPress = function () {
    loadMovie("sub3.swf", _root.loadm);
    _root.loadm.xmlf= link;
};
please help

Putting A Variable INTO A URL...quite LITERALLY
had a good look for tutorials or similar threads but dont quite know what to look for. Basically I want to input a variable quite LITERALLY into a URL like this:

on (release) {
loadMovie("<<VARIABLE>>/image.jpg", "image_frame");
}

where the variable could be called something like "gallery1".

I know there must be a pretty easy way to do it, or if not there damn well should be!

ITs basically needed because i have about 100 pages all in the same format but the individual links need changing like "gallery1/image.jpg" "gallery2/image.jpg" along with a load of other crap which could easily be put into individual txt files as variables instead of crawling through every flash file to change individual links and stuff.
If that didnt make sense or u need any more info ask away!

Putting A Variable In GetURL
I have a button that when clicked, I want it to take them to a url address. I have it set up so that the specific url address is specified by a variable added at the end of the address. How do I incorporate a variable into that address. In this instance the variable is "Portfolio"

Code:

on (press)
{
getURL("http://www.mysite.com/"Portfolio",blank);
}


Thanks!

Putting A Variable In Param Name Html
hello I know that it's possible to put a variable in a html file for a later use. So I make that :

<PARAM NAME=movie VALUE="menu.swf?myMenu=15">

so in flash I put on the first frame:

gotoAndPlay(_root.myVar);

all is okey that worl properly.

but now i need to make a condition:

if (_root.myMenu == "1") {
gotoAndPlay("Open_PowerFinancial");
} else if (_root.myMenu == "2") {
gotoAndPlay("Open_Investor");
} else if (_root.myMenu == "3") {
gotoAndPlay("Open_Mackenzie");
} else if (_root.myMenu == "4") {
gotoAndPlay("Open_Great");
} else if (_root.myMenu == "5") {
gotoAndPlay("Open_Pargesa");
}
stop();


WHY dOES THE VARIABLE IS NOT RECOGNIZE ANYMORE!!!! Flash is just stop at the end and do not check the condition!!!

If that doesnt work I'm dead so, thanks for your help!!!

is it possible to put 2 variable in the param name??

Putting A Long Block Of Txt Into A Variable
I have a variable set up for a frame, and I'm trying to set a large block of text as the value of the variable. That's all well and good, however, I don't know the syntax for separating out my paragraphs in the copy with returns.

Here's an example of the code that I'm using:

_root.text1 = "This is paragraph 1." + Key.ENTER + "This is paragraph 2."

What I get is:

This is paragraph 1.13This is paragraph 2.

It returns the ASCII value of Key.ENTER, rather than actually inserting a return. What simple thing am I missing here?

Thanks...

Putting Instance Names Into A Variable
Hello All. Can you put instance names into a variable? I have a bunch of MC's and would like to set a variable to group them all together so I can tell them all in one shot to go to a specific frame without haveing to tell them all separetly. Say I have 5 mcs with instance names of player1,player2,player3.player3,player4. I would think you could set a variable by saying players=player1,player2,player3.player3,player4 and then with a button say on press players gotAndStop(1)

doesnt work though what am I doing wrong?

Putting Variable Contents In An Email?
Hi,

We're currently working on a restaurant site w/ online ordering and are trying to build an interface with images of each order, and hoping to use variables to keep track of how many times each image has been clicked (ordered)... what we're wondering is if there is some way to then place the contents of these variables in an email to the restaurant once the order is finalized, so that they know exactly how many of each item has been ordered.

Hope this all makes sense- and thanks so much in advance.

Chaasman

Putting Part Of Instance Name In A Variable
I have some movie clip instances called slice1, slice2, slice3, etc...

I am trying to figure out how to extrapolate the number from the instance name and put it into a variable.

Anybody have any ideas?

Putting Copied MovieClip Into A Variable
I used the duplicate movie clip to duplicate a m.c-but later on I want to refer to it in a variable-so how can I put the value of the copied m.c into the variable?
here's my code:

duplicateMovieClip("Tline","TLine"+number,2);
            avail="TLine"+number;
             number++;

when I trace avail now I get Tline5 (for ex.)-but it doesn't reflect the real line that got duplicated
thank you

Putting A 'enter' /linefed In A String Variable
I have a variable which is referenced by a dynamic tex object. When I define the variable in actionscripot what is the code I need to put in for a linefeed or enter

i.e:
textvariable="Line1" + vbreturn + "Line2"

So that the textfield looks like

Line1
Line2

I know this is so simple, but cant find the answer in the docs

TIA

Putting Dynamic Loaded Text Into A Variable
i want to be able to dynamically load some text from a .txt file..
i use this method


Code:
loadText = new LoadVars();
loadText.load("blog.txt");
loadText.onLoad = function() {
blog.text = this.blogtext;
};
using this method i can load the txt from 'blog.txt' into a dynamic text box. but this isn't what i want..
the text i put in blog.txt i want to be equal to a varible in flash.

so i tired...

Code:
loadText = new LoadVars();
loadText.load("blog.txt");
loadText.onLoad = function() {
blog.text = this.blogtext;
var text = this.blogtext;
};
trace(text);
for the output screeen i got "undefined". can anyone tell me how to fix this so when i run it, the output says exactly what i typed in the "blog.txt"?

Putting Dynamic Loaded Text Into A Variable
i want to be able to dynamically load some text from a .txt file..
i use this method


Code:
loadText = new LoadVars();
loadText.load("blog.txt");
loadText.onLoad = function() {
blog.text = this.blogtext;
};
using this method i can load the txt from 'blog.txt' into a dynamic text box. but this isn't what i want..
the text i put in blog.txt i want to be equal to a varible in flash.

so i tired...

Code:
loadText = new LoadVars();
loadText.load("blog.txt");
loadText.onLoad = function() {
blog.text = this.blogtext;
var text = this.blogtext;
};
trace(text);
for the output screeen i got "undefined". can anyone tell me how to fix this so when i run it, the output says exactly what i typed in the "blog.txt"?

About Refreshing The Value Of A Variable Inside Of Another Variable (in A Text Field)
Hello, I have a simple question, but I'm not sure this is possible in Flash:

I'll simplify the problem so that it's easy to understand.

I have a text field holding a variable called "products".

This variable is defined via ActionScript somewhere else, with something like this:


Code:
products = "Some text here" + variable1;


The problem is that, when "variable1" is updated, the value of "products" will obviously remain the same, as it hasn't been redefined (I could redefine it as [products = products + ""] or something, but if I don't include the "variable1" in the definition it won't pick its new value).

I really need to do this with just one text field, and I cannot redefine the whole variable "products" again, as it is much complex than this example and keeps storing info in different ways depending on what the user does.

Any suggestions?
Thanks in advance

Newb Help? Putting A Symbol Inside A Symbol.
All I want is to have a man blink.

The man is a symbol, and there is another symbol inside of him. (his eyes.) Which I already set to blink.

Anyways... It doesn't work. It works when I preview it in symbol editing mode, but nothing else.

I am sorry if I was too vague, I'm still learning. Any help?

Newb Help? Putting A Symbol Inside A Symbol.
All I want is to have a man blink.

The man is a symbol, and there is another symbol inside of him. (his eyes.) Which I already set to blink.

Anyways... It doesn't work. It works when I preview it in symbol editing mode, but nothing else.

I am sorry if I was too vague, I'm still learning. Any help?

Putting "this Frame/scene" In A Variable?
I have a certain frame that is going to be accessible from almost all other frames, so I want to be able to have a variable where when somebody goes to the frame in question it will store where they came from, and then my back button can access that to send them back to the right place

Putting Variable Text Into Dynamic Text Field
How can I make var text input into a dynamic text field that appears within another timeline (movieclip) on a different frame?

Addressing Variable Clips Inside Variable Clips - Easy Question Probably
in actionscript 1 (flash mx (not 2004))

i posted yesterday, and got an answer that solved my simpler problem with the subnav... it is related , so here is the link which should get you up to speed (thanks for bearing with me...)

http://www.flashkit.com/board/showth...hreadid=501186

now what i need to do is address a clip inside a clip and tell it to gotoAndPlay a frame. the thing is, both clips are dynamic. it is a main nav and sub navs for each choice of the main nav, where from the main nav, i need to address the correct main nav clip, and the correct sub nav clip, and tell the sub nav clip to gotoAndPlay a frame.

so if i were to hard code it, it would look like this:

clip1.subClip3.gotoAndPlay("endFade");

but clip1 and subClip3 might be clip4 and subclip6, or whatever, if you know what i mean.. they're dynamic.

i got as far as this in my attempt to solve my problem:

currentSection="clip1";// determined elsewhere

fadethis(currentSection);//called from elsewhere

function fadeThis (fadeMe) {
trace(fadeMe);//returns clip1
fm = this[fadeMe];
trace(typeof(fm) +" "+ fm);//returns movieclip _level0.clip1
}

but i couldnt find a way to get any further than that...

how can i do this? let me know also if i'm explaining this sufficiently... i am having a hard time articulating what i mean, but my fla is way too big so i am hoping someone will understand. i really think this is probably very easy, but i'm just not getting it. and if you do know the answer and do choose to help me, a brief explanation of why your way works and mine doesnt would be super awesom (if you've got the time)...

ok thanks in advance for whoever helps...

-lemur

Variable IF Inside Mc
Hi,

I have the following question:

I have 5 buttons inside a movie clip and i would like to work with the variable IF.

For example, if the button 1 is released it plays the main timeline and after finishing, tru the variable if, the timeline is redirected to a frame x.

i'm sorry if i haven't expressed me well because my english is not one of the best.

As of button 1:

on(release){
_root.play();
bt="teste"
}


As of the last frame of the main timeline

if(bt=="teste"){
gotoAndPlay(233);
}


if the button is direcly placed on the stage the variable IF works normaly, but when the button is inside a mc the _root.play(); action is normal but the variable IF is simply ignored by the time line, and the timeline is not redirected to frame 233.

could someone help me?
thanks,
Peter

See Value Inside Variable
Hi All,

How can I see a value inside a variable?

I have an ActionScript that is in the code of Frame1 of one of my symbols.

I need to see what the value of a variable is inside this script for debugging purposes. What is a good method to do this?

thx

Masking MC With Variable Inside
I have a mc, with 7 variables in there which have a invisible button on them now I want to be able to scroll that mc in a small space . But when I mask the area where I want to see when the scroll happens the text that is assigned to the variable doesn't show up can I mask a mc with a variable in it or what is the way
around this .

Variable Into Sub MC Inside Duplicatemovieclip ?
does anyone know how to solve this?

i use duplicatemovieclip to create i movieclips and need to pass variables into a movieclip inside the new duplicatemovieclip (hope that makes sence):

do {
duplicateMovieClip ("_root.test.dot", "MCO"+i, 10000+i);
setProperty ("MCO"+i, _x, xcoor);
setProperty ("MCO"+i, _y, ycoor);
eval("MCO"+i.+".city.location) = eval("_root.loc"+i);
} while (i<=targetcount);



can i use eval() to set a variable in a embeded movieclip inside a duplicatemoveclip like eval("MCO"+i.+".city.location) = eval("_root.loc"+i); ?

i tried every other idea (set(), etc.), but nothing works.

thanks for any help.

Passing Variable From A Mc Inside Another Mc
ok i'm having a problem....

i have mc "A" with another mc "B" in it.
mc B has a dynamic textfield "valueB" that gets updated
when a radio button is checked in it.

So i set a variable in the parent mc A to the value of variable "valueB" inside of mc B.

i put an actionscript on mc B....

onClipEvent(enterFrame) {
newValue = A.valueB;
}

but it doesn't work when i do a trace of the "newValue"
what am i doing wrong???

Variable Inside A Function
Button code:
[code]
on(release){
function textSwitch(mission, mike);
}


Code:
function textSwitch(screen, item){
_root.text = content[screen][item];
}

content.mission.mike = "I am mike";
content.mission.dani = "I am dani";
content.mission.dale = "I am dale";


I know something is wrong with the way I'm implementing the the passed variables into the function. Specifically, content[screen][item] I think is incorrect. Could you tell me how to fix this?

Loading A Variable From ASP Inside A MC
hI Folks

I want load a variable from one script ASP inside a MC...
And after the data have been loaded in the MC, it sends the varible that it captured for the root.

I try this.

Button on the root:
on (release) {
mc.loadVariablesNum("script.asp", 0, "POST");
texto = "enviando"
}

IN the MC I put this
onClipEvent(data){
_root.texto = this.texto;
}

The asp send this:
texto=jilo

I now that the problems isn't the asp, because I try this with out MC, all in the _root and it Work, I now isn't..

I think that this command isn't right:
mc.loadVariablesNum("script.asp", 0, "POST");..

Helpeme!!!!

Get All Variable Names Inside *.as?
Hey,
I was wondering if it's possible to put all variable names imported from an *.as file inside an array (as strings)?

Example:
code:
//--Code in *.as file---
var someString = "dasdasd";
var anotherVar = ["asd","asd","gads"];
var geehAnotherOne = 6;

//--Generated array should then be---
var generated = ["someString","anotherVar","geehAnotherOne"];


Thnx,
SaphuA

Variable Inside The Clip
The variable (dynamic text) inside the movieclip "char". Should I call it _parent.char.hp?

Set Variable Inside A Movieclip
Hi All,

I try to set some variable inside a movieclip, so I use

_root.mc_name.var_name = 123 ;

so in movieclip "mc_name", there is a variable which equals 123



now I have duplicated this movieclip 12 times by "duplicateMovieClip", and named them mc_name1, mc_name2 .. mc_name12 , and then try to send variable into each movieclip,

so I try

for ... {

_root."mc_name" + id_number.var_name = 123;

}

what I try to do is that id_number will loop from 1 to 12, so a variable will be sent into mc_name1, mc_name2 .. mc_name12

but it does not work

SO, how should I make it work?

many thanks

Get A Variable Inside A Movieclip?
Please refer to the newer post. I double posted on accident

Get A Variable Inside A Movieclip?
I'm sorry if this seems amateur but i'm still getting used to AS3.

I have my main timeline where i declare a String variable such as

Code:
var whichpack:String = "tenpack";
Inside a movie clip thats on the stage, I want to call this variable such as

Code:
trace (whichpack);
I'm getting
1120: Access of undefined property whichpack

How do I make the variable public or global so I can refer to it anywhere in the flash file?

I tried using a package with a class like this

Code:
package com
{
public class SampleCode
{
public var whichpack:String = "tenpack";
}
}
I put SampleCode.as inside a folder called "com" and then put

Code:
import com.SampleCode;
but it didn't seem to work.

Use A Variable Inside A RegExp?
is it possible to use a variable inside a regular expression?


e.x. sometimes i want to find node=man other times node=woman other times node=child


do I have to write 3 different RegExps for this?

Identifying A Mc Inside MC With Variable
hi, there.
this is my problem which needs a fixing
code/
it works if i write
var w = MC._x + MC.SG0._x;
var z = MC._x + MC.SG1._x;
etc...
but not if i write
for(i=0;i<10;i++){
var mc = "SG"+i;
var w = MC._x + MC.mc._x;
// more code
}
can somebody help me,please ????

Copyright © 2005-08 www.BigResource.com, All rights reserved