Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6749191
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:39:37+00:00 2026-05-26T12:39:37+00:00

I’m having a problem with &. Basically I haven’t been able to escape this

  • 0

I’m having a problem with “&”.

Basically I haven’t been able to escape this correctly in Flash AS3, however I did find this link which seems helpful:
http://www.smithmediafusion.com/blog/?p=343

Test page:
http://touchstormdigital.com/leon/testing/

Here are my current functions:

try {
    varHome   = this.loaderInfo.parameters.home;
    homeImage = this.loaderInfo.parameters.homeImage;
    homeTitle = this.loaderInfo.parameters.homeText; // Get the Video Title
    // Title  = "Quick & easy chicken recipes for dinner"
} catch (e:Error) {
    varHome   = "false";
    homeBool  = false;
}

The Search and Replace function:

// Home player test search & replace ampersand
private function replaceString(str:String, find:String, replace:String):String 
{
    var startIndex:Number = 0;
    var oldIndex:Number   = 0;
    var newString:String  = "";

    while ((startIndex = str.indexOf(find, startIndex)) != -1)
    {
        newString += str.substring(oldIndex, startIndex) + replace;
        oldIndex = startIndex += find.length;
    }

    return((newString == "") ? str : newString);
}

And then how I’m using it

private function drawSplash():void
{
    sp = new ScreenButton();

    replaceString(homeTitle,"&", "\\u0026");

    sp.drawScreenButton(playerW, playerH, homeBool, homeImage, homeTitle);
    sp.addEventListener("onPlay", vd.playVideo);
    sp.addEventListener("embedSplash", hideSplash);
    stage.addChild(sp);
}

I think this is where the problem is:

replaceString(homeTitle,"&", "\\u0026");

I’ve also tried this:

replaceString(homeTitle,"&", String.fromCharCode(38));

GOAL
Grab “Quick & easy chicken recipes for dinner” and display it

Still displaying just “Quick”

Test page:
http://touchstormdigital.com/leon/testing/


UPDATE! Another simple fix found and no need to change title!

In addition to The_asMan’s answer which works, but requires the text/copy to be written all weird, I found this simple piece of javascript that does the job:

http://www.w3schools.com/jsref/jsref_encodeuricomponent.asp

How I’m using it:

<script type="text/javascript">

    var homeText = "Quick & easy - chicken' recipes for dinner?!=+";
    var fixed = encodeURIComponent(homeText);

</script>

And then in the Flashvars area:

so.addVariable("homeText", fixed);

Then in Flash:

unescape(homeTitle);

Woot!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T12:39:38+00:00Added an answer on May 26, 2026 at 12:39 pm

    This line here shows me you are loading flash vars.

    homeTitle = this.loaderInfo.parameters.homeText;
    

    For example if you have a url like so.

    http://somedomain.com?var1=aa&var2=b&var3=c
    

    There are 3 variable being passed to flash var1,var2,var3
    When you do

    http://somedomain.com?title=Quick & easy chicken recipes for dinner
    

    You are breaking it in 2 spots the first spot is the ampersand that is telling flash there is a new variable to read. the other spot is the spaces, URLs can not have spaces.
    so the proper way to encode this would be

    http://somedomain.com?title=Quick%20%26%20easy%20chicken%20recipes%20for%20dinner
    

    And then of course in flash an unescape() would be perfect.

    Sorry I should have noticed this sooner it didn’t dawn on me that the data isn’t there.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't
Basically, what I'm trying to create is a page of div tags, each has
this is what i have right now Drawing an RSS feed into the php,
I am currently running into a problem where an element is coming back from
We're building an app, our first using Rails 3, and we're having to build
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.