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




Escaping XML "queries"



Hi there, I'm stuck on an XML query because the XML uses the reserved word "for" in it's namespace; The tricky bit of the XML looks like this;
Code:
<AwayRecord win="3" draw="1" lost="1" for="11" against="7" /> <HomeRecord win="4" draw="0" lost="1" for="10" against="3" />
This works
Code:
sFHomeFor = H2HData.ClubRecord[i].SeasonRecord.ResultsBreakdown.AwayRecord.@against
but this
Code:
sFHomeFor = H2HData.ClubRecord[i].SeasonRecord.ResultsBreakdown.AwayRecord.@for
causes a compile error;"1084: Syntax error: expecting identifier before for." Any ideas? This one's got me stumped... Cheers Ben



KirupaForum > Flash > ActionScript 3.0
Posted on: 10-09-2007, 07:28 AM


View Complete Forum Thread with Replies

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

Various Queries
Is it just me or is it difficult to find the link to post a new thread - I eventually found it under the User Control Panel but why isn't it on the individual forum pages as well?

My specific queries are:

1.How do you close a browser window (in other words the web page) from within a .swf which is embedded in that web page?

2.How come none of the publish settings allow one to center the Flash movie horizontally and vertically on the html page? I have tried html alignment = default and flash alignment = center (horizontally and vertically) but none of these work.

3.What code would you use where at the click of a button (which is within a movie clip) it takes you to the second frame of the movie clip which then takes you to the next scene?
For e.g. in the case of a quiz where each question and its possible answers (which are actually picture-like buttons within movie clips) are in their own scene – when you click one of the answers you hear a “wrong” beep (located on the down frame of the button) if it is incorrect, similarly you get a “correct” beep when correct. When you click the correct button you also see a circle appearing round the button to show that this is the correct option. (I have placed this circle in the second frame of the “button” movie clip with a stop action.) The problem is from there I want the user to automatically be taken to the next scene where they would be presented with the next question and its possible answers. I don’t know how to do this.

Any help would be much appreciated.

Thanks

Newtoo

Two Queries
Hi there

Following on from my last post, here is the flash file (sorry could only attach a zipped version of the swf - the fla is too large) for query 3. Where I am stuck is that when the user clicks on the correct answer and gets a thick black border around it and hears a "correct sound", I want him or her to immediately be taken to the next scene. I can't do this at the moment because I have put the black border in the second frame of the movie clip with a stop action which seems to stop the whole movie not just the movie clip.

I would also like to know if there is a way to thicken the line in a Join the Dots type game - for example see no. 5 at http://www.the-stickman.com/tutorial...llaneous.shtml (The reason I need this is I am trying to create something for children.)

Thanks a lot

Newtoo

SQL Queries
I'd like to be able to call SQL server stored procedures directly from flash MX 2004 pro in a similar way that an XML file can be used via the data components. Is there a way to do this without usin any kind of ASP/Web services? I guess the RDBMS component would be the only way, or connecting directly through actionscript however I'm not sure how.

Thanks in advance for any help

Queries
hi, i want to draw line(path) beetwin two destination.it has so many destination so i m planning to do with actionscript.i want this line aniamated when i click on the first button(destination) to second button(destination). is it possibele? if yes then tell me how it is.

thank you.

XML Queries....
Hi,

My heart felt thanks for all who are helping out on these forums. Without you guys i would not have been put into the correct platform to think...anyway, i am now starting on XML...i have created a simple XML/Flash file that reads data from a SML sheet, but i noticed that the flash does NOT display numbers from the data. For example if i have test12324, it displays test. That's all.

The code for it is below....


Code:
function loadXML(loaded) {
if (loaded) {
//populating the text fields
_root.ftext = this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;
_root.sectext = this.firstChild.childNodes[1].childNodes[0].firstChild.nodeValue;
_root.thirdtext = this.firstChild.childNodes[2].childNodes[0].firstChild.nodeValue;
_root.fourthtext = this.firstChild.childNodes[3].childNodes[0].firstChild.nodeValue;
firsttext.text = _root.ftext;
secondtext.text = _root.sectext;
third_text.text = _root.thirdtext;
fourth_text.text = _root.fourthtext;
} else {
trace("file not loaded!");;
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("datafirst.xml");
I don't know how flash is ignoring the numbers. Does this have to do with any settings of the dynamic update textfield ?

Escaping &
How do you escape an "&" in a string.
" quotation
\ backslash
 backspace

OT - Director 8 Queries
Sorry that this is so off-topic, but there seems to be a complete lack of useful Director resources. Someone pointed me in this direction saying i may get help here.

I'm pretty much a beginner with Director and I've got 2 questions about scripting. The first is,I want a generic rollover script for changing a sprite to another(I can make ones that are sprite specific but that means a lot of seperate scripts).
Theres something in the helpfile under rollovers about a script that swaps the sprite with the next one in the cast which would be perfect, but im a bit clueless with scripting at the mo and it doesnt explain it simply enough.

Secondly, I've got 5 rollover sprites that, when the mouse moves over them, i want some text to appear elsewhere on the stage.
Someone said about creating an invisible sprite and making it so the rollover changes the invisible sprite to some cast members consisting of the pieces of text. But im getting a pretty stuck with all the scripting for this as well.

Any help is appreciated
Thankyou

Navigation :: Some Queries ::
hey all,
I have two questions...I ahve three numbers as buttons I have a line underneath "1" as it is the first to be selected. When button number "2" or "3" is pressed I want the line to slide along and go underneath whichever button is pressed. so basically there is three buttons and whichever button is pressed a line goes to that button.

My second question is in the old praystation when you clicked on a button it went red and then when you went somewhere else ie to another button it dimmed and the current button turned red. I want to do this but with actionscript and not with turning MCs on and off as it gets heaps clumsy...

thanks,
tom

Multiple Queries
HI,

Im putting together a corporate guidelines document in Flash MX using buttons and basic actionscript, but im stuck with a few things...

1. Is it possible to restrict the size of the final published flash document so it cant be stretched from the size specified in the movie?

2. Can you link from the document to open up Outlook Express with a new window/e-mail?

3. Is there an action that can be assigned to a button to print the document?

4. Is there an action that will exit from the published document/software?

Cheers,

Lynzi

Function Queries
i have never used functions in flash, i think its a very useful tool but i dont have clear understanding of it, can anybody make me understand it and tell me how can i learn it

Mouse And Url Queries :(
Hi,

I've started trying to learn Flash a couple of days ago, as I was trying to put together a website for our Eve-Online corp (dunno if anyone here has heard of the game). I had seen others and they were impressive.

Anyway, if you check out http://nrc.atspace.com you'll see my 1st attempts. Only prob is I cannot seem to get the getUrl or onRelease commands to work for the buttons; I get this error message needs to be within on layer or something. I've tried the code in the button script and as a frame script, referring to the button's instance name. Any ideas, please?

Secondly, you'll see i'm using a custom pointer. This is gonna be a two parter:

1. How do i restrict movement (in this case horizontal) so you don't get to see the stumpy wrist? Really it just needs to go up and down, at a point I can choose.

2. Does it look tacky????

RemoveChild Mc From Within A Mc And Some FLV Queries
I have built a site that seems to work just how I wanted. It loads external swf files, adds them to the stage. These act as my content pages activated by a menu bar which is a movie clip on my stage. The swf pages all contain movieclips which look like mini windows. These mini windows can be drag and dropped, and closed independently. When both are closed, the mc containing the external swf is removed. Problem is the miniwindow movie clips contain flv video, and the swf doesn't actually close, so the flv remains loading in the background making everything far too slow.

I've tried various methods to get around this, but nothing I've tried seems to get rid of the swf/ flv files from memory.

So instead, I thought I would have them as movieclips and add/remove them as neccessary to have better control over what's going on.

But, I have hit a stumbling block that I'm hoping you can help with.

In order to try and get things working as I want, I've left the main site, and been working in a test window. I have everything on the stage at first. All content movieclips are removed from stage in as3. I have a button on stage (in place of what will by my proper menu bar) that when clicked will addChild the movieclip that contains the relevant content into a sprite container.

This movie clip contains 2 mini windows. They are both drag and droppable. Each mini window is it's own movieclip. Some of them include an flv video and text field, some just a textfield and image.

I want to be able to close them independently by clicking on a close square on each of the mini windows. I have everything working, but I cannot seem to get removeChild to do what I need. I think it has something to do with it being a mc within a mc. I've tried every way I know and can't get it to work, so over to you.

Code Pasted below. Thanks in advance.


Code:
removeChild(dvdMC);
removeChild(viewerBG);
var contentContainer:Sprite = new Sprite();
addChildAt(contentContainer, 1);
contentContainer.x = 0;
contentContainer.y = 0;
//var contentLoader:Loader = new Loader();
var backgroundsActive:int = 2;
function loadDvd(event:MouseEvent):void {

contentContainer.addChild(viewerBG);
contentContainer.addChild(dvdMC);
//dvdMC.gotoAndPlay(2);
}
function closeDvdWindow1(event:MouseEvent):void {
trace("close window ONE");

//contentContainer.removeChild(??????); //PROBLEM LINE
//dvdMC.caseStudy1.flv1.stop();
backgroundsActive -= 1;
if (backgroundsActive == 0) {
trace("close content bg too");
contentContainer.removeChild(viewerBG);
}
//trace(backgroundsActive);
}

function closeDvdWindow2(event:MouseEvent):void {
trace("close window TWO");
//contentContainer.removeChild(dvdMC.caseStudy2); // PROBLEM LINE
backgroundsActive -= 1;
if (backgroundsActive == 0) {
trace("close content bg too");
contentContainer.removeChild(viewerBG);
}
}



//drag and drop content windows code

function startDragDvd1(event:MouseEvent):void {
trace(numChildren);
dvdMC.caseStudy1.startDrag();
}
function stopDragDvd1(event:MouseEvent):void {
dvdMC.caseStudy1.stopDrag();
}

function startDragDvd2(event:MouseEvent):void {

dvdMC.caseStudy2.startDrag();
}
function stopDragDvd2(event:MouseEvent):void {
dvdMC.caseStudy2.stopDrag();
}


dvdMC.caseStudy1.dragArea.addEventListener(MouseEvent.MOUSE_DOWN, startDragDvd1);
dvdMC.caseStudy1.dragArea.addEventListener(MouseEvent.MOUSE_UP, stopDragDvd1);
dvdMC.caseStudy2.dragArea2.addEventListener(MouseEvent.MOUSE_DOWN, startDragDvd2);
dvdMC.caseStudy2.dragArea2.addEventListener(MouseEvent.MOUSE_UP, stopDragDvd2);
dvdMC.caseStudy1.closeDvdBox.addEventListener(MouseEvent.CLICK, closeDvdWindow1);
dvdMC.caseStudy2.closeDvdBox2.addEventListener(MouseEvent.CLICK, closeDvdWindow2);

contentButton1.addEventListener(MouseEvent.CLICK, loadDvd); // dummy button for now, until I get this fixed and then I can replace with proper nav bar system

I have another problem after this gets fixed too, which will be how to only make the flv load when you click on the video screen, but I shall worry about that after I get this issue fixed.

Localization Queries
Hi I am using localization for some of the predefined messages in one of our application.
We are using strings panel to generate the language xml. I am a newbie in this.
My queries are :
1)It generates and reads the language xml in the current working directory of the .fla file.Is it possible to place these xml some where else(other than current working direcotry) and then read/load it from there.

2) Locale.loadLanguageXML reads all the 21 supported language xml for region code mentioned in string panel but doesnot read data for customed culture.

Is it possible to add the culture and sub culture and read the language xml for same.

3) is it neccessary to embed the different fonts for different language code?

4) How to include Icelandic language code and generate the language xml for same.

5) In the language xml generated from string panel, there is one tag named XLIFF(XML language interchange file format). It contains trans-unit tag which should contain source and target tag as per documentation for XLIFF. but in our case it generates only source tag and not target tag.Even it doenot recognise target tag.The sample XLIFF tag is as follow:


<?xml version="1.0" encoding="UTF-8"?>

<xliff version="1.0" xml:lang="en">

<file datatype="plaintext" original="PatternPainterApp.fla" source-language="EN">
<header></header>
<body>
<trans-unit id="001" resname="IDS_START_BTN_INSTRUCT_MSG">
<source> Start in English</source>
</trans-unit>
<trans-unit id="002" resname="IDS_TEST_DONE_INFO_MSG">
<source>Test Done in English</source>
</trans-unit>
</body>
</file>

</xliff>


Please help me get out of these queries.Thanks in advance.

A Few AS Sound Queries
Hi I have a few questions regarding the use of sound.

1) If I wanted to reuse a sound file on numerous buttons would I just create the object on the root and reference it as shown in the code below.

2) If I was to use the stopAllSounds() script when a button is clicked would that mean that any sound meant to play for that button would not play. This is when I have the stop all sounds script above the script for the sound clip, for the button (which is the reused one mentioned above).

Hope this makes sense
Thanks







Attach Code

//_root code sound code//
Sound1 = new Sound();
Sound1.attachSound("soundFile.mp3");

...............................................

//Button sound//
button1.onRelease = function()
{
stopAllSounds();
_root.Sound1.start();
}

Detecting Queries
Just curious to know if its possible. I have a nav that is in flash and will be in many .asp pages. Could a corresponding button in the nav stay highlighted to represent where a user is by detecting what page it is on?

any help would be greatly appreciated.

SwfObject Queries Please Help
Hello

I am using swfobject 2.0 to generate an html file. Now the problem is the expressInstall.swf file is not doing anything and it is directly jumping to the alternate html page which gives the url to adobe website to download flash player


I have flash player 9 installed.

Any suggestions
Thanks in advance

SwfObject Queries Please Help
Hello

I am using swfobject 2.0 to generate an html file. Now the problem is the expressInstall.swf file is not doing anything and it is directly jumping to the alternate html page which gives the url to adobe website to download flash player

I have flash player 9 installed.

Any suggestions

Thanks in advance

Escaping Characters
evening

i need to read in a text file and escape an ampersand within a string. does anyone know of a list of such escape sequences for future reference?

cheers

Escaping A Loop
Lets say i have an array of 165 items, and i want to use a loop to go through the array item by item, checking to see if the item meets some criterion. But once i find an item that meets the criterion, perhaps myArray[45], i want the loop to stop. how do i break out of the loop?

edit: if it helps at all, i have a dude who can pick up one item at a time. Presently i'm using an "if else if" series to go through the items to have the dude pick up an item he's near without picking up more than one item. It works, but for future reference...

Escaping Quotes
Is there a function of something in actionscript to escape double quotes? I know how to do it in PHP, but I have been having trouble figuring out the same thing in actionscript.

I know normally it would be something like this var = "blah "blah" but the problem is that the variable is actually another variable pulled out from a mysql db via PHP.

So basically, is there a function in actionscript to escape quotes, or do I have to have it all pre-escaped in PHP?

Escaping A SetInterval ?
Im tyring to have something happen in waves.

I want to dynamicly stop and restart a SetInterval loop i'm in. Because of the variable changing it would make more sense logicly if I looped things outside the setinterval

(rather than within the interval itself)

is this a bad idea / how would I accomplish this?

Escaping For Loop?
I'm using Kirupa's "search array" to check wether something is loaded.

It "works" however it doesn't stop if daft = 1, so it keeps checking and gives its final answer as 0

if I can't escape from the for loop

I don't know



Code:
for (i=0; i<pressArray.length; i++) {
trace("array"+i+" "+pressArray[i]);
if (pressArray[i] == pos) {
daft = 1;
//delete for
/// exit for loop
//return -1
} else {
daft = 0;
}
}
thanks

Character Escaping
Simple question:

I want to put a degree sign in a variable that will be assigned to a variable text field.  I know the ascii escape code (Not in front of me now, let's say it's (escape sequence here - Tek-Tips keeps processing it for me)).  

I set the variable like as an array in the beginning:


quiz[x][3] = "Must use 150 (escape sequence) F water"


Then later I set the variable that is the variable text field equal to that array element:


varfortext = quiz[x][3]


I've tried all variations of unescape and everything, but I can't get it to display anything but the actual escape sequence (ampersand-numbersign-whatever-the-code-is-plus-a-semi-colon)...

Any suggestions?

Ben

Escaping The Variable
hi guys,

i am developing an application in flashcomm for my univerity project, an interactive elearning system using no components, to make it lighter

the project goes well until i got this bug, this is the default color to talk in the chat :

"<font color = "#009900">bla</font>"

works fine but when i do this, no color and message appear in the box

userColor = "#009900"
"<font color = "+userColor+">bla</font>"

maybe i am not escaping well the variable or there is something i am missing.

any help is appreciated ! thx

Dynamic Text Queries..
I've been having several problems with dynamic text. Was wondering if there was anything I was doing wrong.

1. I no longer see the option for multiline in the properties. So unless I have a scroller component attached to my dynamic text boxes, they export with single lines of text which are very wide and obnoxious.

2. I'd like to use some rather obscure typefaces in my dynamic text. They are true type fonts. Is there a way to embed these within the exported file so those without the typeface (including mac users) can see the intended typeface?

3. One thing about static text? Is there a way to anti-alias it? Side by side with dynamic text, it looks like some sort of blurry monstrosity. Dynamic text always appears much clearer. Any ideas?

Thanks alot!

Shawn

Another Loading Movies Queries....
This is probably really simple but I'm tearing my hair out ... I have made a website where after loading up the first page, the user then clicks on buttons to see various movies. At the moment I have attached a load movie action to each button to load an swf, (each of which are around 70K if that makes any difference)
Is there a way to preload all the swfs at the beginning so there is no delay when the user clicks on the buttons cos at the moment each swf has its own preloader and this makes for a lot of halting and waiting for each one to preload. I was told to bring them in in movie clips and make them invisible , but i havent managed to make that work.
Any suggestions please ....

[CS3] A Couple Of AS2 Coding Queries
Hello,

I am in the process of teaching myself various new skills with ActionScript for a project I've been hired to undertake.

I've used Flash for a couple of years but have never ventured into proper action scripting, having relied on Script Assist.

The project will be required to have several functions which will require fairly heavy scripting (from my perspective).

I am not asking for the code to be handed to me, obviously, although examples that I could examine would be very much appreciated.

The whole project revolves around dragging objects with letters on them onto a grid, where they snap into place on a grid with snapping points 50px apart to make words.

I have found a tutorial with this drag / drop / snap-to code in it, and have successfully created a grid and a draggable square which snaps to the grid (using the bottom left corner of the MC). This grid is visible, and takes up the entire screen. However, it will need several other things doing to it...

- The grid will only need to take up a portion of the working environment, with the rest of the stage being used for user controls / interfaces
- The grid will need to be invisible to the user
- The objects on the grid have to appear there after the user clicks a representative button in the "control panel"

Those are the absolutely crucial issues at the moment, the third one especially. I've spent an hour searching Google looking for "flash tutorials making objects appear on mouse click" and all sorts of variations, to no avail.

As I said, I'm very new to Flash action scripting, but I can read script and roughly dissect it to understand what each bit is doing (as I managed to do here)/

So I'm after the same sort of guidance really...I'd like to know the feasibility of my project as well as where I could go to begin teaching myself how to turn what needs to be done into an end result.

I am not averse to copying / pasting code as long as I am required to look over it and change it. This won't be avoidable anyway.

Many thanks for any help you can give me!

[CS3] Flashvars, Queries And Caching
Hi all -

I have a question...I have seen some references to this in past posts, but the posts don't seem to solve my problem. Any help would be greatly appreciated.

I have a page that loads 10 of the same swf. Each swf is given different flashvars, so each displays different infomation.

To stop the user from having to download each file over and over, I would like the browser to use the swf in the cache (so that I don't have to load the same swf over and over...people go back to the same page again and again and see the same swf. I understand how to use a version query to ensure that people have the most up-to-date swf).

If I do NOT include a query when I load the swf (that is, I use sample.swf instead of sample.swf?randnum=xxx), this works fine when the user has "check for newer versions" set to "everytime I visit a page" in IE.

However, when the user has this setting set to "automatically," the flashvars do not load.

If I do include a query, it (weirdly) works only most of the time...sometimes all of the swfs get the flashvars, sometimes only the first few do.

My sense from the previous posts is that there is no solution to this? I am hoping I am wrong...can I somehow call an swf that just gets the variables with a query (so the user can reload this small swf over and over without any problems) which then calls the bigger swf?

If so, is there a simple way to do this (I am using actionscript 3.0)? I am happy to look it up - just give me the general command to call a new swf and pass variables to it.

Thanks!
N

Window Component Queries
I would like to use the window component, and think that this must be very easy, but I have never used components before so I have a few quick questions.

1. I would like to stop it from bieng draggable There doesn't seem to be anything in the Component Inspector to this effect, so how would you recomend I do this?

2. Content. I would like to arrange my content in some moveable windows, such that the content moves with the window. I am sure that this is a very superficial mistake, as right now I am makeing the window a movieclip, and then simply layering them above this. I will keep looking, but the help section on the window component sucks.

If anyone could advise me on this I would heartily appreciate it.

HTML Queries Not Working
I have been reading the posts on using HTML queries and used numerous other examples from other sites. I just cant seem to get it to work. I published a flash file and an HTML file from flash and then added the query "myVar = hello" after the filename both times in the HTML file. Here is the actionscript in my flash file:



Code:
var paramObj:Object = root.loaderInfo.parameters;
var tf:TextField = new TextField();

for(var i:int = 0; i < 4; i++){
tf = new TextField();
tf.autoSize = TextFieldAutoSize.LEFT;
tf.border = true;
tf.x = 50* i;
addChild(tf);
switch(i){
case 0:
tf.text = root.loaderInfo.parameters.myVar.toString();
break;
case 1:
tf.text = root.loaderInfo.parameters.myVar;
break;
case 2:
tf.text = paramObj.myVar.toString();
break;
case 3:
tf.text = paramObj.myVar;
break;
}
}
And here is my HTML:


Code:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>LoadVars</title>
<script language="javascript">AC_FL_RunContent = 0;</script>
<script src="AC_RunActiveContent.js" language="javascript"></script>
</head>
<body bgcolor="#ffffff">
<!--url's used in the movie-->
<!--text used in the movie-->
<!-- saved from url=(0013)about:internet -->
<script language="javascript">
if (AC_FL_RunContent == 0) {
alert("This page requires AC_RunActiveContent.js.");
} else {
AC_FL_RunContent(
'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
'width', '550',
'height', '400',
'src', 'LoadVars',
'quality', 'high',
'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
'align', 'middle',
'play', 'true',
'loop', 'true',
'scale', 'showall',
'wmode', 'window',
'devicefont', 'false',
'id', 'LoadVars',
'bgcolor', '#ffffff',
'name', 'LoadVars',
'menu', 'true',
'allowFullScreen', 'false',
'allowScriptAccess','sameDomain',
'movie', 'LoadVars',
'salign', ''
); //end AC code
}
</script>
<noscript>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="550" height="400" id="LoadVars" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="false" />
<param name="movie" value="LoadVars.swf?myVar = help" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /> <embed src="LoadVars.swf?myVar = help" quality="high" bgcolor="#ffffff" width="550" height="400" name="LoadVars" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
</noscript>
</body>
</html>

Coordinates And Colour Queries
ok. first of all in a movieclip im making for choosing a colour form the user for getting the hue, saturation and luminouns(dont know how to spell it) it gets the _x of the coorespondent mc and then the _xmouse and/or _ymouse of it. Problem is that when the mcs are scaled down or up their internal dimensions dont cahnge so an mc scaled at 100% _xmouse might be 50. But scaled to 200% with the mouse in the same position would still be 50, and not 25 which is what i need it to do.


ActionScript Code:
pr._y = shade._y+shade._ymouse;
l_ = 240-((240/shade._height)*shade._ymouse);
            lum = Math.round(l_>=0 && l_<=240 ? l_ : l_>=120 ? 240 : 0);
// this part is jsut to make sure lum. cannot go outside of 0-240
 


-------------------------------------------------------------------------
second problem is one i posted a while ago.

From a user typing in the hexdecimal representation of the colour, or indeed skipping a step of converting the hexdecimal to rgb values. How can the RGB then be converted to the Hue, Sat., and Lum. of the colour, therefore placing the pointers to the correct positions.
#this one is probably the one im most concerned about

dELta

Queries + Return Won't Work?
Hi. I'm doing this login thing with flash using amfphp and as3. Here's my code.
AS3:
import flash.net.*;

var gw:NetConnection = new NetConnection();
gw.connect("http://localhost/flash_login/amfphp/gateway.php");

var res:Responder = new Responder(onResult, onFault);

function onResult(responds:Object):void {
trace (responds);
echo.text = String(responds);
}

function onFault(responds:Object):void {
for (var i in responds) {

trace (responds[i]);

echo.text = String(responds[i]);
}
}

gw.call("Login.login", res, "Testeri" , "jeesus");

And here is PHP:
<?php

class Login {
/**
*This service gets login
* @returns string type "true" or "false"
*/
public function __construct() {
mysql_connect("localhost", "user", "password");
mysql_select_db("table_name");

}
function login($userName, $passWord) {

if($userName == ""){
return "false";
}
else {
$query = "SELECT * FROM users WHERE username='".$userName."'");
$result = mysql_query($query);
$row = mysql_fetch_assoc($result);
if($row['username'] !== $userName){
return "false";
}
else {
if($row['password'] !== $passWord){
return "false";
}
else {
return "true";
}
}
}
}//End of function
}
?>
Output:
Error #2044: Unhandled NetStatusEvent:. level=error, code=NetConnection.Call.BadVersion
at flash_login_fla::MainTimeline/frame1()

What does that mean?
I can get the query to the flash. I can also get the string variable to flash but I can't combine these. Any ideas where I'm doing wrong?

Escaping Flash Text
I am reading some text from XML and displaying it in a text area. However all of my apostrophies show up as &apos;. Is there a way to escape this. I am embedding the fonts in the text area so I wasn't using HTML.

-Alex

Escaping Carriage Returns In XML?
Hey guys,

I've tried a few different combinations without any success. Basically, I want to include carriage returns in strings in the XML file. The string in Flash would look like:

var string:String = "This is the first line...
...and this is the second line.";

This gives malformed XML:
<string>This is the first line...
...and this is the second line</string>

This just gives the '
' characters escaped:
<string>This is the first line... \n ...and this is the second line</string>

Is there some special XML escape notation that I need to know about?

Escaping Special Characters
Hi,

I'm trying to make string variables from value that I need to use for widget embed code.

The code I would like to make a string out of is


ActionScript Code:
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="400" height="200" id="mixtape" align="middle">
        <param name="allowScriptAccess" value="sameDomain" />
        <param name="allowFullScreen" value="false" />
        <param name="trackids" value="


The double quotes cause all sorts of madness and I read somewhere that you can "cancel" them by using the "" character.

So I put a "" before every double quote and then enclosed the whole lot in double quotes.


ActionScript Code:
private var str1="<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="400" height="200" id="mixtape" align="middle">
        <param name="allowScriptAccess" value="sameDomain" />
        <param name="allowFullScreen" value="false" />
        <param name="trackids" value=""


Flash keeps on throwing the following error


ActionScript Code:
1095: Syntax error: A string literal must be terminated before the line break.

Could somebody please help me learn how to do this properly?

Thanks,

dub

Escaping Sequence Charecters
Hi guys

Some of the following escaping sequences that I cannot get:


Code:
Escape sequence Character
 Backspace character (ASCII 8)
f Form-feed character (ASCII 12)

Line-feed character (ASCII 10)

Carriage return character (ASCII 13)
Tab character (ASCII 9)
" Double quotation mark
' Single quotation mark
\ Backslash
00 -377 A byte specified in octal
x00 -xFF A byte specified in hexadecimal
u0000 -uFFFF A 16-bit Unicode character specified in
hexadecimal

Code:
 Backspace character (ASCII 8)
f Form-feed character (ASCII 12)

Line-feed character (ASCII 10)

Carriage return character (ASCII 13)
Tab character (ASCII 9)
About the tab and the backspace, they R KEYS, so how can I insert them as a charecter in my program???

and the other three.. I don't know what's exactly their function, their job??


Code:
00 -377 A byte specified in octal
x00 -xFF A byte specified in hexadecimal
u0000 -uFFFF A 16-bit Unicode character specified in
hexadecimal
??????????????????????

explain please

thanx guys

CU

Escaping Special Characters In Xml
I have an XML file that has answers to a quiz done in Flash and AS 1.0. One of the questions has answers in the form of "> 1" "< 1". This particular answer is referring to less than a year or more than a year. The < doesn't show up at all in the answers screen, probably because it needs to be escaped. Is that possible or do I need to spell out the answer. BTW, is in French which I don't speak so i am opting for keeping the answers as they are, and work around the problem by escaping, had it been Spanish or English I would rewrite the answers comfortably. Any suggestions would be greatly appreciated. Encoding for the XML file is xml version="1.0" encoding="utf-8"





























Edited: 07/01/2008 at 10:49:37 AM by RGracia

Escaping Characters In Dynamic URL Txt
hi, i'm pulling in this text via getURL


HTML Code:
"javascript:DB_openNewWindow('http://myurl.org/flash/flash.htm','main','width=730,height=460,left='+((screen.availWidth-730)/2)+',top='+(((screen.availHeight-460)/2)-50)+',toolbar=no,location=no,directories=no,menubar=no,resizeable=no,scrollbars=no,status=no')"
I tried escaping all of the quotes and single quotes using but it's still not working.

Are there other characters that need to be escaped?

(that exact code works fine when placed on the button in the FLA)

thanks...

Escaping Character For Amfphp
amfphp is supposed to be easy. for the most part, it is. i love that i can send arrays of arrays and not worry about anything.

i am having trouble though with some things that would be otherwise very basic just POSTing to a php script directly...

when i send a string containing a single quote ( ' ) and try and use it in a mysql query, the query will fail. addslashes() does not work.

i noticed in the amfphp "common errors" documentation says:


Quote:




AMFPHP uses $HTTP_RAW_POST_DATA as its input. This variable is not affected by magic quotes. Thus all your service arguments will act as though magic quotes was set to off. If you try to insert something with a quote in it without escaping it you will receive an error back from your sql driver. Use the database specific escaping function on your strings before running SQL, for example mysql_real_escape_string for MySQL.




so i tried running


PHP Code:



mysql_real_escape_string( $val ) or die("problem trying to escape");$sql = "UPDATE $tableName SET `$fieldName`='$val' WHERE `item_id`='$id' LIMIT 1"; 




and if $val contains a single quote, then the script dies at the escaping.

any ideas?

ever seen this before?

thanks

jaz

Escaping Complex String
hi guys!

is there a way to escape a statement and make it a string?

here is:

"C:Archivos de programaSymantecpcAnywhereawrem32.exe" "C:Documents and SettingsAll UsersDatos de programaSymantecpcAnywhereNETWORK, CABLE, DSL.CHF"

the "" have to be conserved since is the name of the file and the antoher is the param for the exec.

thx for any help...

>>>DYNAMIC TEXT FIELD QUERIES<<<
Why do dynamic text fields in the .swf take up more space than in the flash file (source)?

And, is their any way of creating links direct from text in a dynamic text field?

Please help!

Idea Creation Project Queries
Hello there, nice to be on board

I'll dive straight in :-)

We are company are trying to develope an interative idea generation program in flash MX. But we have come a little unstuck with the following problem.



Can we do the following:-

1. Allow the user to input text (i.e names) to be saved to a folder on the users hard drive so when needed, these name can be generated randomly within the flash interative program ?

Would it also be possible for the user to access our web site and for Flash to recognise the user and be able to direct itself straight to this mini database on the users
hard drive ?

If so we would be greatfull if anyone could point us in the right direct

many thanks

Jez

FLASH 8 XML Gallery Queries [newb Help Please :)]
hi,
I've just made a flash gallery using an amazing tutorial; and I've followed it quite well, and now everything is working.

The only problem is the alignment of the thumbnails and the main image.

Just so you get an idea - http://www.justmarried-photography.c...oot2/trial.swf

Now what I want is to have the thumbnails underneath the buttons in 2 rows, and then have the image open up where it is opening at the moment - ie only move thumbnails.

If anyone can tell what bit I need to edit to achieve this I'd be grateful, as my grasp of actionscript is quite minimal.

Also I'd like to know if it's possible to have everything other than the photo darken (ie background etc fade out darker) leaving the picture in prominence upon clicking the thumbnail?

if so anyone know how? How would this work with the current actionscript?

The actionscript for this gallery is below.



Quote:




var menuSpeed:Number = 6;
var menuDown:Button = menuDown_btn;
var menuUp:Button = menuUp_btn;
menuUp._alpha = 0;
menuUp.enabled = false;
var firstLook:Boolean = true;
var menuButtons:MovieClip = galleryMenu_mc.buttonsHolder_mc;
var galleryMask:MovieClip = galleryMenu_mc.galleryMask_mc;
galleryMask._height = 600;
var imagesHolder:MovieClip = imagesHolder_mc;
var descText:TextField = desc_txt;
var imagesInGallery:Array = new Array();
var galleryNames:Array = new Array();
var galleryIntros:Array = new Array();
var descriptions:Array = new Array();
var tracker:Number = new Number();
var whatIsLoading:String = new String();
var galleryBtnLeftMargin:Number = 10;
var galleryBtnUpperMargin:Number = 100;
var galleryBtnVSpace:Number = 23;
var thumbMarginX:Number = 80;
var thumbMarginY:Number = 75;
/* -------------------- Aligning and positioning imagesHolder_mc, the logo and the description text field -------------------- */
imagesHolder._x = 237;
imagesHolder._y = 75;
logo_mc._x = logo_mc._y=galleryBtnLeftMargin;
desc_txt._x = 243;
desc_txt._y = 400;
/* -------------------- The welcome text -------------------- */
descText.text = "Click on a gallery name on the left to load its thumbnails. Remember, you can click on a thumbnail only when all the thumbnails in a gallery have been loaded. When you click on a thumbnail to see the big image, clicking on the big image will close it and you will return to the gallery. Use the button(s) above the galleries to scroll through them.";
/* -------------------- Importing and defining the DropShadow filter -------------------- */
import flash.filters.DropShadowFilter;
var shadowEffectropShadowFilter = new DropShadowFilter(3, 45, 0x000000, 100, 3, 3, 1, 3);
var thumbsFilter:Array = [shadowEffect];
/* -------------------- MovieClipLoader & Listener -------------------- */
var loader:MovieClipLoader = new MovieClipLoader();
var myListener:Object = new Object();
loader.addListener(myListener);
myListener.onLoadInit = function(target:MovieClip) {
if (whatIsLoading == "thumb") {
currentThumbnail.percent_txt._visible = false;
currentThumbnail.filters = thumbsFilter;
thumbClickable();
tracker++;
if (tracker<howManyImages) {
loadThumbnail();
} else {
enableThumbs();
}
} else if (whatIsLoading == "big") {
target._alpha = 0;
displayBigImage.percent_txt._visible = false;
displayBigImage.filters = thumbsFilter;
bigClickable();
fadeIn();
}
};
myListener.onLoadProgress = function(target:MovieClip, loaded:Number, total:Number) {
percent = Math.floor(loaded/total*100);
if (whatIsLoading == "thumb") {
currentThumbnail.percent_txt._visible = true;
currentThumbnail.percent_txt.text = percent+"%";
} else if (whatIsLoading == "big") {
displayBigImage.percent_txt._visible = true;
displayBigImage.percent_txt.text = percent+"%";
}
};
/* -------------------- loading XML -------------------- */
var imageGallery:XML = new XML();
imageGallery.ignoreWhite = true;
imageGallery.onLoad = function(success) {
if (success) {
parseGalleries();
} else {
descText.text = "Sorry the image data just didn't load.";
}
};
imageGallery.load("gallery/gallery.xml");
/* -------------------- parsing XML -------------------- */
function parseGalleries():Void {
if (imageGallery.firstChild.nodeName == "galleries") {
var rootNode:XMLNode = imageGallery.firstChild;
for (i=0; i<rootNode.childNodes.length; i++) {
if (rootNode.childNodes[i].nodeName == "gallery") {
currentGallery = rootNode.childNodes[i];
imagesInGallery.push(currentGallery.childNodes.len gth);
galleryNames.push(currentGallery.attributes.title) ;
galleryIntros.push(currentGallery.attributes.intro );
currentGalleryTitle = rootNode.childNodes[i].attributes.title;
currentGalleryButton = galleryMenu_mc.buttonsHolder_mc.attachMovie("galle ry section button", "galleryButton"+i, galleryMenu_mc.buttonsHolder_mc.getNextHighestDept h());
currentGalleryButton._x = 0;
currentGalleryButton._y = galleryBtnVSpace*i;
currentGalleryButton.sectionTitle_txt.text = " "+currentGalleryTitle.toUpperCase();
for (j=0; j<currentGallery.childNodes.length; j++) {
if (currentGallery.childNodes[j].nodeName == "image") {
currentDescription = currentGallery.childNodes[j].firstChild.toString();
descriptions.push(currentDescription);
}
}
}
}
}
numberOfGalleries = i;
enableButtons(numberOfGalleries);
}
function enableButtons(numberOfGalleries:Number):Void {
for (i=0; i<numberOfGalleries; i++) {
pressedButton = galleryMenu_mc.buttonsHolder_mc["galleryButton"+i];
pressedButton.onRollOver = function():Void {
this.gotoAndStop(2);
};
pressedButton.onRollOut = function():Void {
this.gotoAndStop(1);
};
pressedButton.onPress = function():Void {
removeMovieClip(thumbsDisplayer);
removeMovieClip(displayBigImage);
tracker = 0;
thumbsDisplayer = imagesHolder.createEmptyMovieClip("thumbsDisplayer _mc", imagesHolder.getNextHighestDepth());
clickedGallery = Number(this._name.substr(13));
howManyImages = imagesInGallery[clickedGallery];
whichGallery = galleryNames[clickedGallery];
descText.text = galleryIntros[clickedGallery];
currentRow = 0;
currentColumn = 0;
loadThumbnail();
};
}
enableGalleryNavigation();
}
function loadThumbnail() {
currentThumbnail = thumbsDisplayer.attachMovie("thumbnail holder", "thumbnail"+(tracker+1), thumbsDisplayer.getNextHighestDepth());
target = currentThumbnail.thumbImage_mc;
if ((tracker%5) == 0 && tracker != 0) {
currentRow += 1;
}
if (currentColumn>3) {
currentColumn = 0;
} else if (tracker == 0) {
currentColumn = 0;
} else {
currentColumn += 1;
}
currentThumbnail._x = currentColumn*thumbMarginX;
currentThumbnail._y = currentRow*thumbMarginY;
currentThumbnail.percent_txt._visible = true;
thumbNumber = currentThumbnail._name.substr(9);
thumbPath = "gallery/"+whichGallery+"/thumbs/"+thumbNumber+".jpg";
whatIsLoading = "thumb";
loader.loadClip(thumbPath, target);
}
function thumbClickable():Void {
currentThumbnail.onPress = function() {
bigNumber = this._name.substr(9);
displayBigImage = imagesHolder.attachMovie("big image holder", "bigImage_mc", imagesHolder.getNextHighestDepth());
target = displayBigImage.imageHolder_mc;
bigImagePath = "gallery/"+whichGallery+"/"+bigNumber+".jpg";
whatIsLoading = "big";
disableThumbs();
loader.loadClip(bigImagePath, target);
if (clickedGallery>0) {
var descPosition:Number = 0;
for (i=0; i<clickedGallery; i++) {
descPosition += imagesInGallery[i];
}
descPosition = descPosition+Number(bigNumber)-1;
imageDesc = descriptions[descPosition];
} else {
imageDesc = descriptions[Number(bigNumber)-1];
}
descText.text = imageDesc;
};
currentThumbnail.enabled = false;
}
function disableThumbs():Void {
for (i=0; i<howManyImages; i++) {
thumbsDisplayer["thumbnail"+(i+1)].enabled = false;
}
}
function enableThumbs():Void {
for (i=0; i<howManyImages; i++) {
thumbsDisplayer["thumbnail"+(i+1)].enabled = true;
}
}
function bigClickable():Void {
displayBigImage.onPress = function() {
removeMovieClip(this);
enableThumbs();
descText.text = galleryIntros[clickedGallery];
};
}
function fadeIn():Void {
target.onEnterFrame = function():Void {
this._alpha += 10;
if (this._alpha>=100) {
delete this.onEnterFrame;
this._alpha = 100;
}
};
}
function enableGalleryNavigation():Void {
menuDown.onPress = function() {
if (firstLook) {
menuUp._alpha = 100;
menuUp.enabled = true;
firstLook = false;
}
var menuTop:Number = menuButtons._height-Math.abs(menuButtons._y);
if (menuButtons._y<=0 && menuTop>=galleryMask._height) {
var targetPos:Number = menuButtons._y-galleryMask._height;
menuDown.enabled = false;
menuUp.enabled = false;
menuButtons.onEnterFrame = function():Void {
menuButtons._y += (targetPos-menuButtons._y)/menuSpeed;
if (menuButtons._y<=(targetPos+0.8)) {
menuButtons._y = Math.round(targetPos);
delete menuButtons.onEnterFrame;
menuDown.enabled = true;
menuUp.enabled = true;
}
};
}
};
menuUp.onPress = function() {
var menuTop:Number = menuButtons._height-Math.abs(menuButtons._y);
if (menuButtons._y<0 && menuTop>0) {
var targetPos:Number = menuButtons._y+galleryMask._height;
menuDown.enabled = false;
menuUp.enabled = false;
menuButtons.onEnterFrame = function():Void {
menuButtons._y += (-menuButtons._y+targetPos)/menuSpeed;
if (menuButtons._y>=(targetPos-0.8)) {
menuButtons._y = Math.round(targetPos);
delete menuButtons.onEnterFrame;
menuDown.enabled = true;
menuUp.enabled = true;
}
};
}
};
}

NEWBIE FLASH/SORENSON 101 Queries
Can anyone help a newbie?

I'm a videographer by hobby, who's been roped into to an interview by a client. Thats fine I have a 85secs talking head video DV PAL, in Final Cut (sorry adobe, I went mac, before you returned to the platform) which I'm being asked to convert to a single swf file of no more than 2Mb, be no larger than 300x250, no smaller 250x200, no less than 96Kbps audio, it must include play stop pause and preferably volume controls. Now I'm struggling with the file size, but also, the point of the post, I end up with 2 files an swf and flv file, how do you embed them into one swf file in Sorenson Squeeze, I can see no clue anywhere on or in Sorenson, player controls? And how do you constrain the on screen file when you drop it on a web page, they open typically blocky full screen.

If anyone could help would be appreciated, and if anyone could recommend any video and audio bit rates setting as well, you'd make one confused camera man very happy...

Problems Loading JPG & BG Color W/URL Queries
First the setup.

The Flash file is v5. Inside it contains...

(frame 1)
a movieclip instance called "listener" (no actionscript)

(frame 2)

ActionScript Code:
Code:loadMovieNum(_root.t,2);



(frame 3)

ActionScript Code:
Code:i = new Color(_root.listener);
i.setRGB(_root.c);
stop();



The problem.

I want to use URL queries params to load SWF, and JPG files as well as change the background color. The "listener" MC was created so I can change the BG color. Except for SWF files, JPGs don't load and the "listener" MC doesn't change color. The URL query I'm passing to the flash movie looks like: ?t=site_v1.3.swf&c=0xCCCCCC

Here's where I left off at if you want to check it out:
http://www.kxmode.com/test/?t=site_v1.3.swf&c=0xCCCCCC

Am I missing something?

Escaping Variables From Text File
I have this presentation that has loads of text fields in it. The contents of these text fields i am loading from an external text file, so they are all variables. The problem is some of the text has characters in it that need escaping like '&', '/' and '+'. now i have done a few tests and i can use the escape(variable_name) to fix this if i created the variable from within flash, but it doesn;t seem to work with any variables i bring in from this text file?? i've tried telling flash the variable is a string but that didn't help, I've also tried putting the variables in speach marks in the text files but it just displays these speak marks in the presentaion???


can any one help please?

Escaping Ampersands In Dynamic Text
O.K. . . .

This has got to be a little on the dim side, because I can't imagine this is not a common problem, but what seems like the logical solution is not working.

Specifically, I am having trouble rendering dynamic text that contains ampersands. I know why it is happening but not what to do about it.

All my content is dynamic and is read in from a Cold Fusion file calls vars.cfm, which is passed various parameters. An example of the file that might be generated is this:

&teaser=Local businessmen reinvent wheel&the_text=Fred Flintsone & Barney Rubble said today they were about ready to unveil a prototype . . .

etc. . .

In my movie, I have a dynamic text box called long_text, and I set it's content this way:

long_text.htmlText = subVars.the_text;

And what you would think happen does. Flash renders "Fred Flintstone " then chokes on the ampersand because it thinks it's getting another variable.

I tried this:

var newText = escape(subVars.the_text);
var realText = unescape(newText);
long_text.htmlText = realText;

Which didn't work. And this, based on a find/replace prototype authored by Cyberfunk, and which I know works quite well in other instances:

var newText = subVars.the_text.replace("&","%26");
long_text.htmlText = newText;

And that doesn't work either.

Any ideas?

As usual, I apologize if I'm missing something obvious.

Ed

Escaping Double Slash In XML Data?
Hi

I have a URL in some XML data in my AS, of course it has // in it and Flash is thinking this is a comment - how do you get around this?

Thanks

Edward.

Escaping Fullscreen Losing Focus
Does anyone know if there's a workaround to the fact that when you escape fullscreen mode in a browser, the swf seems to lose focus? I'm doing fullscreen video and I have to press the pause button twice when returning from fullscreen. I noticed the same problem with YouTube videos.

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