Regexp - Replacing HtmlText With Valid Xhtml
Hi,
I'm building a custom RichTextEditor so the user can set a title, subtitle and paragraph in the text. But because the htmlText of the textArea returns depracated html, I wanted to replace it with valid xhtml.
So I have something like this:
HTML Code: <TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Verdana" SIZE="20" COLOR="#232323" LETTERSPACING="0" KERNING="1">This should be a h1 title</FONT></P></TEXTFORMAT> That should be replaced to:
HTML Code: <h1>This should be a h1 title</h1> But the problem is that I can't find a way to close the h1 with </h1> without doing it for both </h1> and </h2>
This is the code to replace the start-tags <h1>,<h2> and <p>:
ActionScript Code: pattern = /<P.*><FONT.*SIZE="20".*?>/g;str = str.replace(pattern, "<h1>"); pattern = /<P.*><FONT.*SIZE="14".*?>/g;str = str.replace(pattern, "<h2>");pattern = /<P ALIGN="LEFT">/g;str = str.replace(pattern, "<p>");
This code closes the tags:
ActionScript Code: pattern = /</FONT></P>/g;str = str.replace(pattern, "</h1>");pattern = /</P>/g;str = str.replace(pattern, "</p>");
But in case I have a title and a subtitle it closes it twice with </h1>. Anyone an idea? I'm looking into the String.search() function but I'm not getting any results...
Thx!
KirupaForum > Flash > ActionScript 3.0
Posted on: 09-01-2007, 09:42 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
XHTML Valid SWF
Hey I have this:
Code:
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="800" height="168" id="head-1" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="flash/head-1.swf" />
<param name="quality" value="high" />
<param name="wmode" value="transparent" />
<param name="bgcolor" value="#ffffff" />
<embed src="flash/head-1.swf" quality="high" wmode="transparent" bgcolor="#ffffff" width="800" height="168" name="head-1" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
When I use this it doesn't show up:
Code:
<object type="application/x-shockwave-flash" data="flash/head-1.swf" width="700" height="116">
<param name="movie" value="flash/head-1.swf" />
<img src="images/head-1.jpg" width="700" height="116" alt="header" />
</object>
It needs the Embed tag it seems, i looked on google for this;
im using xhtml 1.0 strict
A .swf In Valid XHTML Strict
Alright, I'm trying to put a soundloop on my blog, but I want it to remain XHTML 1.0 strict.
'Strict' doesn't allow Iframes, and transitional gives me errors.
I have tried
<iframe name="music" width=75 height=50 src="http://moments.mo.funpic.org/nucleus3.2/skins/stanch/player.html" frameborder=0></iframe>
But I get a SHORTTAG error on transitional.
Is there any way to call a .swf (with defined width and height) while remaining XHTML strict?
XHTML Valid Source
So I searched around all over the internet and VERY few flash sites are XHTML valid.
I've generated the following code with thanks to Kirupa's flash object generator as well for an XHTML VALID flash page.
Enjoy ( fully commented on what you need to change )
HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>****PUT YOUR PAGE TITLE HERE****</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
<!--
body,html
{
margin:0px;
padding:0px;
height:100%;
}
-->
</style>
</head>
<body>
<!-- REPLACE FOLLOWING USING http://www.kirupa.com/developer/flash8/flash_fix.htm TO GENERATE CODE AS WELL AS DOWNLOAD THE FLASH OBJECT JAVASCRIPT FILE FROM THAT PAGE -->
<script type="text/javascript" src="flashobject.js"></script>
<div id="flashcontent" style="width: 100%; height: 100%"></div>
<script type="text/javascript">
var fo = new FlashObject("finalIndex.swf", "animationName", "100%", "100%", "8", "#F1F1F1");
fo.addParam("allowScriptAccess", "sameDomain");
fo.addParam("quality", "high");
fo.addParam("scale", "noscale");
fo.addParam("loop", "false");
fo.write("flashcontent");
</script>
</body>
</html>
Valid XHTML Preloader Problems
Hello all,
I have a preloader that isn't working in IE 6.0 Win but works well in the other browsers I've tested it in (Firefox, Opera). In IE the preloader isn't displayed and the movie only starts after the preloader is 100% finished. The other browsers show the preloader fine.
Here's the HTML code for it that works in the other browsers
Code:
<object type="application/x-shockwave-flash" data="images/main.swf" width="600" height="200">
<param name="movie" value="images/main.swf" />
</object>
If I want it to work properly in IE though I need this...
Code:
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="600" height="200" id="intro">
<param name="movie" value="images/main.swf" />
</object>
...but then it doesn't even show up in Firefox. I've done some tests and it's the classid and codebase attributes that make the difference. Is there a way to fix this and keep it XHTML valid?
How To Embed Flash On XHTML 1.0 Strict, But Valid.
I have a problem with a web page that i am making, seems that the code that flash creates when publishing a project is not validating with xhtml 1.0 Strict and xhtml 1.0 Transitional doctypes. Any idea how to fix this ?
[MX04] Valid XHTML With EMBED & OBJECT Tags?... Possible?...
Is it possible to pass validation (http://validator.w3.org/) for transitional XHTML if you use the OBJECT and EMBED tags to embed your swf file?... No matter what i do... I can't make my page valid.
There also seems to be a lot of trouble with my flash detection passing validation.. if it helps... i'll include player detection script
Code:
<head>
<script language="javascript" type="text/javascript">
var requiredMajorVersion = 7;
var requiredMinorVersion = 0;
var requiredRevision = 19;
var jsVersion = 1.0;
</script>
<script language="vbscript" type="text/vbscript">
Function VBGetSwfVer(i)
on error resume next
Dim swControl, swVersion
swVersion = 0
set swControl = CreateObject("ShockwaveFlash.ShockwaveFlash." + CStr(i))
if (IsObject(swControl)) then
swVersion = swControl.GetVariable("$version")
end if
VBGetSwfVer = swVersion
End Function
</script>
<script language="javascript1.1" type="text/javascript">
var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
jsVersion = 1.1;
function JSGetSwfVer(i){
if (navigator.plugins != null && navigator.plugins.length > 0) {
if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
descArray = flashDescription.split(" ");
tempArrayMajor = descArray[2].split(".");
versionMajor = tempArrayMajor[0];
versionMinor = tempArrayMajor[1];
if ( descArray[3] != "" ) {
tempArrayMinor = descArray[3].split("r");
} else {
tempArrayMinor = descArray[4].split("r");
}
versionRevision = tempArrayMinor[1] > 0 ? tempArrayMinor[1] : 0;
flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
} else {
flashVer = -1;
}
}
else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2
else {
flashVer = -1;
}
return flashVer;
}
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
{
reqVer = parseFloat(reqMajorVer + "." + reqRevision);
for (i=25;i>0;i--) {
if (isIE && isWin && !isOpera) {
versionStr = VBGetSwfVer(i);
} else {
versionStr = JSGetSwfVer(i);
}
if (versionStr == -1 ) {
return false;
} else if (versionStr != 0) {
if(isIE && isWin && !isOpera) {
tempArray = versionStr.split(" ");
tempString = tempArray[1];
versionArray = tempString .split(",");
} else {
versionArray = versionStr.split(".");
}
versionMajor = versionArray[0];
versionMinor = versionArray[1];
versionRevision = versionArray[2];
versionString = versionMajor + "." + versionRevision; // 7.0r24 == 7.24
versionNum = parseFloat(versionString);
if ( (versionMajor > reqMajorVer) && (versionNum >= reqVer) ) {
return true;
} else {
return ((versionNum >= reqVer && versionMinor >= reqMinorVer) ? true : false );
}
}
}
}
</script>
</head>
<body>
<div align="center">
<script language="JavaScript" type="text/javascript">
var hasReqestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
if (hasReqestedVersion) {
var oeTags = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"'
+ 'width="100%" height="100%"'
+ 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" >'
+ '<param name="movie" value="movie.swf" /><param name="menu" value="false" /><param name="scale" value="noscale" /><param name="wmode" value="transparent" /><param name="bgcolor" value="#FFFFFF" /><param name="quality" value="high" /><param name="bgcolor" value="#FFFFFF" />'
+ '<embed src="movie.swf" quality="high" bgcolor="#FFFFFF"'
+ 'width="100%" height="100%" name="movie" aligh="middle"'
+ 'play="true"'
+ 'loop="false"'
+ 'wmode="transparent"'
+ 'quality="high"'
+ 'allowScriptAccess="sameDomain"'
+ 'type="application/x-shockwave-flash"'
+ 'pluginspage="http://www.macromedia.com/go/getflashplayer" />'
+ '</embed>'
+ '</object>';
document.write(oeTags);
} else {
var alternateContent = 'This site requires the Flash Player plugin. Download the latest version now...'
+ '<br /><br />'
+ '<a href="http://www.macromedia.com/go/getflash/" target="_blank"><img src="upgrade_flash/images/get_flashplayer_88_31.gif" alt="Get Flash Player" />'
+ '<br />GET FLASH</a>';
document.write(alternateContent);
}
</script>
<noscript>
This site requires a JavaScript enabled browser and the Flash Player plugin. Download the latest version now...
<br /><br />
<a href="http://www.macromedia.com/go/getflash/" target="_blank"> <img src="upgrade_flash/images/get_flashplayer_88_31.gif" alt="Get Flash Player" />GET FLASH</a>
</noscript>
</div>
</body>
I get 10 errors total... most are for every instance that the '&' is used... the others relate to the object and embed tags.... take a look.
Warning Line 71 column 31: character "&" is the first character of a delimiter but occurred as data.
if (navigator.plugins != null && navigator.plugins.length > 0) {
Warning Line 129 column 34: character "&" is the first character of a delimiter but occurred as data.
return ((versionNum >= reqVer && versionMinor >= reqMinorVer) ? true : false
Error Line 147 column 78: an attribute specification must start with a name or name token.
...d:d27cdb6e-ae6d-11cf-96b8-444553540000"'
Error Line 147 column 78: document type does not allow element "object" here.
...d:d27cdb6e-ae6d-11cf-96b8-444553540000"'
The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).
Error Line 151 column 18: there is no attribute "src".
+ '<embed src="movie.swf" quality="high" bgcolor="#FFFFFF"'
Flash Detection From Flash 8 Not Xhtml Valid
Hi
Been searching the forum to see if anyone else has come across this issue.
Validating a page with w3c which has the flash detection script that publishing directly from flash to display the flash. w3c is chucking it back as not valid xhtml due to the doc declaration. The reason it is throwing it back as not valid is due to the comment nesting within the script i.e. // comment within an opening comment tag <!-- to hide it from non javaScript enabled browsers.
Is there a re-written version to allow for xhtml validation?
Cheers
Is This Css? Or Xhtml Or What?
the right side of cuban councilhttp://www.cubancouncil.com/main.php there is that text menu where u rollover and color changes and it allows you to turn off side notes. also, on two thirty medias site he uses this same method. So what language is used to create this kind of thing and if u know where is the best place to learn how?
Xhtml And Flash
hey all, im new here and i have a quick question:
i am using editplus to make a personal webpage for my web course, i need to know the steps and elements used to put a flash document into the page. i have exported my .fla file and have the .swf file now, so now all i need is the code for putting it in my page and have it validate has a valid xhtml document(transitional 1.0)
ANYTHING will help, thanks
[Edited by ooga booga2002 on 09-23-2002 at 11:24 PM]
<embed> In XHTML
when using XHTML transitional for my web page, the XHTML validator at www.w3c.org objects to the <embed> tag. I am using the <embed> tag within the <object> tag so that my flash movie will run in browsers which use the plugin version of the flash player(not the windows activex version).
Does the XHTML definition not include the embed tag and if not then how will browsers which cannot use the activex version of flash run them?
Or is there special XHTML I should write to run plugin versions of flash player?
Rob
XHTML Strict
Hi,
I'm redoing a site that has some Flash movies and am trying to figure out how to make them validate in XHTML strict. I found one website that seemed to have some nice information about it (here, if you're interested) and it does seem to work but I'm worried that some of the stuff I had to leave out might be important. The original tag was:
Code:
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="180" height="195" style="float:left; ">
<param name="movie" value="../_psychology-movies/abusechild2.swf" />
<param name="quality" value="high" />
<embed src="../_psychology-movies/abusechild2.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="180" height="195"></embed>
</object>
And the new tag is:
Code:
<object type="application/x-shockwave-flash" data="../_psychology-movies/abusechild2.swf" width="180" height="195" style="float: left; ">
<param name="movie" value="../_psychology-movies/abusechild2.swf" />
<param name="loop" value="false" />
alt : <a href="../_psychology-movies/abusechild2.swf">abused-child.swf</a>
</object>
Do I need to be concerned about any of the stuff I had to leave out? Specifically, if people don't have a Flash player on their machine, will they still be prompted for it? And is there a better way to do this or is this it?
Thanks.
Flash @ XHTML
HI !
I'm tring to fitt a swf but i got problems with the postioning.....
Margin left should be 339 & Top -180
the following i wrote:
Quote:
<object classid="CLSID:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0"
width="159" height="176" style="margin-top:-180; margin-left:339">
<param name="movie" VALUE="../images/pr1_tst.swf">
<param name="quality" value="high">
<param name="scale" value="exactfit">
<param name="menu" value="false">
<param name="WMODE" value="transparent">
<embed src="../images/pr1_tst.swf" quality="high" WMODE="transparent"
scale="exactfit" menu="false" width="159" height="176"
swLiveConnect="false" type="application/x-shockwave-flash"
pluginspage ="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">
</embed>
</object>
the swf is shown @ upper left of the page. To resolve this problem i tried to insert:
Quote:
style="margin-top:-180; margin-left:339"
but it didn't work.
any ideas ?
THX
What Gives: Flash And XHTML?
It may not be a flash XHTML issue but I honestly have no idea. Ignoring maybe some glaring issues (design or programming), I just want to understand why the flash on this page does not function as it should:
http://www.blinkmusic.com/musicdemo.html
But works fine when you load the swf directly:
http://www.blinkmusic.com/flash/audio_player1.swf
XHTML & Flash Preloader.
Hi,
I develope to XHTML 1.0 standards and i use this code (well similar i just ripped this off the satay site)
but what it is is that the preloader doesn't load until the movie is complete..this is no good.
Is there anyway I can load a small 2kb flash file that will pre-load the main movie but with a visual preloader for the second movie? eg
movie 1 is 2kb and only has the scripting for preload code and can get the size of the second movie, and then when its loaded it will then load the second movie.
Abyss.
Why Detection Kit Is Not Xhtml Strict?
Hi,
we designed an xhtml strict website.
The macromedia detection script is not valide for the w3c xhtml standard.
Why?
http://validator.w3.org/check?verbose=1&uri=http%3A//www.vangogh-creative.it/premiowww/index.html
Flash Xhtml Compliance Help
Hello all,
New to the forum, but long time reader. I was wondering if I could get someone to help me clear up some errors. I added a script to my site to get some flash music on the site for later on. However, I have cleaned up about 20 of the errors that came with the code. I am down to my last 11. I am sure that someone with flash and xhtml experience can help me clear these things up. I am just hoping that someone has the time.
Here you can see my site
http://www.myndpollution.com
Here you can see the errors that are left:
http://validator.w3.org/check?uri=www.myndpollution.com
I know that the validator is not 100% however, it does give me some guidlines to follow when making the site viewable. If anyone can give this a go I would appreciate it very much.
Thanks in advance for anyones help. I have already scoured the internet and seen, viewed, tried a few things. However, my lack of flash and xhtml compliance limits what I can try or if I run into a problem... fix.
Thanks again
Kind regards,
Mynd
http://www.myndpollution.com
[f8] XHTML/CSS And Flash Problem
Howdy,
Anyone having this problem? Got a nice clean XHTML/CSS site going with a cool flash easing navigation but the flash keeps "flashing" when I change pages. The background is not the colour I set in flash or CSS?? http://www.terrychurchdesign.com.au or see the problem more obvious at http://www.lancasters.com.au
Html/xhtml Parsing
can i get a normal webpage and parse with actionscript (regexps) to get the information i need if yes please help me a bit (I can not apply xml parsing if it is not valid xhtml right ?)
XHTML Compliant Flash
I just realised that my pages with flash content embedded arent compliant. Does anyone know of code to fix this problem?
HELP ~ Flash Buttonset, XHTML & CSS
Hi all:
I've just created a buttonset that contains 9 buttons, all actionscripted. On mouseover a shape tween of a coloured box beneath the text slides from left to right out of obscurity and on mouse-up (after clicking) the font colour changes and the block colour remains behind the text. When this is repeated with another button the actionscript dictates that the previous button clicked plays the rest of the tween so the box tweens away out of sight and so on.
I first implemented this concept with frames where the button set had it's own frame and targeted the _MainFrame. However I've recently started to learn CSS without frames and each button targets _self. The problem is when another page is loaded by the browser so does the buttonset. This means the button clicked on is no longer highlighted as the flash is reloaded.
Please, if anybody knows a way to get round this problem reply a.s.a.p.
Thank you in advance,
Chris.
FP XHTML Render Component
Hi All,
i was searching for a solution for getting tables in Flash and found the component which renders xHTML into flash.
Now this works perfect. but i want more control over it. i want to put the parsed xHTML into a textfield.
Opening an example and publish it gives me errors so i can't use that code...
somebody who has experience with this component and can help me?
Or maybe there is another solution?
Greetz
Flash + XHTML 1.0 Strict
Right
After seeing the amazingly bloated code that flash generates to display a movie inline with a webpage, I went searching and came accross an article on ALA which outlines this code:
Code:
<object type="application/x-shockwave-flash" data="logoanimation.swf" width="130" height="100">
<param name="movie" value="logoanimation.swf" />
<img src="images/noflash.gif" width="130" height="100" alt="" />
</object>
Now that works really well! (NN4 + Mozilla 1.3 + IE 6) and has the bonus that if flash isn't supported it loads up the 'failsafe' gif image
So what's the deal? is it okay to do it this way?
I've got it up and running here and that page validates as XHTML 1.0 Strict at the moment (not finished though heh)...
Flash On An XHTML Page
HTML Code:
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="550" height="400">
<param name="movie" value="movie.swf" />
<param name="quality" value="autohigh">
<param name="menu" value="false" />
<embed src="movie.swf" quality="autohigh" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="550" height="400" menu="false"></embed>
</object>
The FAQ says this is how you put a flash object on your website. However, this does not pass Strict XHTML 1.0 validation because of the embed tag. Is there a way to do this that will pass XHTML 1.0 validation?
Thanks!
External FLV Php/xhtml Positioning Is Not Right
Hi,
I'm 98% finished a site/project I am working on, but I'm having problems when I insert the embed flash code into the php/xhtml document. For some reason the player, doesn't seem to be paying attention to the css and I can't budge it's positioning on the page. It just needs to be moved down about 7 pixels and across 3-4 pixels. It's driving me nuts.
I didn't really do any of the development, but I have been having a fiddle with it as well. Is anyone an expert in coding up flv files in a php/xhtml document?
This is part of the code for the flash part
<div col="right_col">
<script type="text/javascript" src="swfobject.js"></script>
<div id="flashcontent">
<strong>You need to upgrade your Flash Player to version 8 or later.</strong>
</div>
<script type="text/javascript">
var so = new SWFObject("flvPlayer.swf?imagePath=480x270.jpg&videoPath=video.flv&autoStart=t rue", "sotester", "300", "250", "8", "#000000");
so.write("flashcontent");
</script>
Validate XHTML With Flash
Hello,
I am trying to get my website to validate to XHTML standards but errors are coming up in my code where Flash is included. I have read quite a few posts/sites about this now and have been experimenting with different bits of code. I can't seem to find an easy way of getting my pages to validate and also work in both IE in Firefox. Can anyone suggest an easy way of getting my pages to validate and work in both browsers. I don't need to stream my flash but it does need to have a transparent background. Any suggestions?
Thanks in advance,
Katherine
Creating A PHP Mailform In Xhtml
hello all
I am just looking on the net for tutorials in creating a simple mailform that validates entries using PHP in xhtml.
If anyone can point me to some tuts or provide an example of how to implement this then I will be gratefull.
regards
w9914420
Xhtml File Extension
Hello U_S guys,
i'm a noobie and i really think i 'm going to ask a basic_stupid question. I always used notepad to write html code, but from few days I'm using NVU editor that save files in xhtml. I'm ok with xhtml but i have a question: when i upload to the server can i change the *.xhtml extension in *.html or this is a deprecated action? I'm only asking because my hosting is not letting me editing xhtml files directly on the server and each time i have to do changes on the source file that "should be somewhere on my hard disk" and then upload it again and again... so i thought to renome the xhtml file with an html extension but i'm not sure it's a good tip and i am scared to loose the addictional X-potential of the file.
thank u!
nuby wuby - bye
RegEXP Help
I have the following string:
<item name="Home Child 1" data="2" pagetype="2" />
I need to extract the value of the pagetype attribute using regExp NOT xml.
Can someone please help?
RegExp (again)
ActionScript Code:
var pattern1:RegExp = /"/gi; // " double quote
var pattern2:RegExp = /'/gi; // ' single quote
var pattern3:RegExp = /</gi; // < less than
var pattern4:RegExp = />/gi; // > greater than
var pattern5:RegExp = /(/)/gi; // / forward slash
var pattern6:RegExp = /(\)/gi; // back slash
questionSstring = questionTextField.text;
questionSstring = questionSstring.replace(pattern1, """); // " double quote
questionSstring = questionSstring.replace(pattern2, "'"); // ' single quote
questionSstring = questionSstring.replace(pattern3, "<"); // < less than
questionSstring = questionSstring.replace(pattern4, ">"); // > greater than
questionSstring = questionSstring.replace(pattern5, "&#.47;"); // / forward slash
questionSstring = questionSstring.replace(pattern6, "&#.92;"); // back slash
Surely there's a way to make 1 pattern instead of 6 paterns. As you can though, for now, I'm running a string thru 6 seperate times. Do I have to filter 6 times or can I filter only once? What would be the RegExp code to consolidate?
RegExp.as Help
Has anyone used the RegExp.as class? If so I would love to see some samples of how you are working with it. I downloaded the class file from http://www.jurjans.lv/flash/RegExp.html and have not been able to get it to work at all.
Here is a simple example I have been trying to work with all day that comes up as "undefined".
ActionScript Code:
#include "RegExp.as"
re = new RegExp("[0-9]","g|i");
trace(re.test("thisisatest99xxx"));
This should fine the number 99 in the string but doesn't seem to work at all.
Help?
Thanks
Help In RegExp
hi
i need to convert the code (0,0,2,84,69,93,76,49) as 0,0,2,84,69,93,76,49.
How can use the regular exp for this code
~~
SK
[AS3] RegExp
I am trying to write out a RegExp pattern to validate an e-mail. I have googled but can't seem to find a definite answer but what characters/symbols are not allowed in a valid email address?
Is RegExp the way to go to validate an email format? I started off using the below way, but then started looking into RegExp:
ActionScript Code:
function validateEmail( email:String ):Boolean
{
var i:int = -1;
var n:int = email.length;
if( n <= 6 )
{
return false;
}
var invalidChar:String = "~^*|,":<>[]{}`';()&$#%";
while( ++ i < n )
{
if( invalidChar.indexOf( email.charAt( i ) ) != -1 )
{
return false;
}
}
return true;
}
RegExp?
Hi,
This RegExp is kinda confusing... Can someone plz take sometime to explain RegExp concept for Actionscript 3.0....
Flash Rendering With XHTML Strict DTD
This is more of an annoyance than a problem, since the site renders properly in transitional. I have a flash object that flows into the rest of the site design but when I use a strict DTD there is a 3 pixel margin between the flash object and the rest of the site. It renders perfectly in IE (for once) but not in firefox. I can't figure out what's causing the gap. Any ideas?
[F8] Searching An Xhtml Page With Flash
Hello,
I am new to these forums and this is my 1st post!!!
I am a little stuck with a project i am developing. I have a flash header on a normal XHTML web site. Within this flash header i would like to include a search function that would enable the user to search all pages within my site.
Is this possible? If so how would i go about doing it?
Is there a better method to use than this?
I would appreciate all help on this matter.
Cheers
Evan
Brain Fart (xhtml Related)....
OK I know this isnt related to actionscript per say but in my html based site (which you go to if you dont go to the flash site) I need this; I am having trouble coming up with code since its been so long- can anyone HELP!
*name must appear at the top, centered and in the h1 size.
* a horizontal rule beneath name that goes across 75% of the page - and a blank line after the horizontal rule
* a table with one cell in the left column and three rows in the right column The single cell on the left must contain a thumbnail (1" by 1") image which, when clicked by the user, opens a window with a larger version of that picture; a 1" by 1" that opens to a 3" by 3"
any ideas or can anyone help!!!!
Embedding Flash + XHTML + FlashVars
Hello,
I think many of you might already read the article by alistpart on how
to embed Flash in correct XHTML syntax, e.g.
http://www.alistapart.com/articles/flashsatay
The article is a little bit old but so far I can't any better article
than this.
After some testing,I found that this approach didn't work with the FlashVars
Just like the example in the above URL:
<object type="application/x-shockwave-flash
data="c.swf?path=movie.swf"
width="400" height="300">
<param name="movie"
value="c.swf?path=movie.swf" />
<img src="noflash.gif"
width="200" height="100" alt="" />
</object>
I need to use the query string method.
Anyone has experience in using FlashVars + XHTML Flash Embedding?
Thanks.
Ricky
Swap Flash Movie In Xhtml
hey all
probably a real simple solution but have got a brain block!!
anyhow, have a flash movie embedded into a xhtml div on the page. i have a list of text links in the xhtml that when selected i want to load a new flash movie into the div
make sense..simple!?
XHTML 1.1 Validation Using Embed Tags
I would love to hear some peoples opinions on this. I am not sure what to think.
I added the following to my php script,
<script type="text/javascript">
<!--
if ( navigator.appName == "Netscape" ) {
var flash = ''. $flash_embed_tags_go_here .'';
}
else {
var flash = ''. $flash_object_tags_go_here .'';
}
document.write( flash );
// -->
</script>
I am using standard embed and object tags. My pages validate in any version of xhtml from scrict to 1.1. They have validated in Moz5, Opera7, NN7, and IE6.
I don't know why they validate. I can see how they could validate if the browser is using the object tag but they also validate using embed.
I could really use some people's opinions on this. BTW, my pages won't validate in html 4.01 strict. It gives a error on both the object and embed tags.
Embedding Flash Into XHTML Site.
Hello Everyone, this is my first post here. I'm looking forward to the future in this community. I have a problem with this specific document i've been working with. I just can't seem to get the flash working properly. I know it's something within this page causing the problem because i published a fresh HTML page using this video, uploaded, and it works fine. But i used the same bits of code on the real page and it just goes away. Let me know if you think of anything that i could have missed. Please feel free to make me look like a newb because at least this thing will get fixed! Thanks for the help!
-MB
RegExp Class
Hallo,
Here is the new RegExp class for Flash5 ActionScript. Of course, it's slower than client-side JavaScript, but for ActionScript unusually quick.
Try out yourself:
http://www.jurjans.lv/flash/RegExp.html
RegExp In Browser
Hello,
I have made a flash applet in which a string is checked using the RegExp.exec() method. This works fine when I test it locally, but when I upload it to my website, the RegExp no longer works. Why would this be? :S
Here is my code:
Code:
function comp(e:Event){
var str:String = e.target.data;
browser.text += e.target.data;
var imgRE:RegExp = /<img[^>]+ids*=s*['"]([A-Za-z0-9]+)['"][^>]*/s*>/g;
do{
var exec:Object = imgRE.exec(str);
if (exec) browser.text = exec[1];
}while(exec);
}
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, comp);
loader.load(new URLRequest("Content/home_2.html"));
It loads an external HTML file and then checks it for img tags. It then takes the "id" parameter of the img tag (as exec[1]) and puts it into a textbox on the stage.
Thanks for your help - sorry if this is a stupid question!
RegExp Patern
hallo all
does anybody know if i can assign a string variable as a RegExp patern?
thnx a lot!
I Have Some Question With RegExp
Hello everybody, I have been read "RegExp Class help", but I still unknown
The first Questoin:
Code:
//I want 123,456,789
//but it is 123456,789
var str:String = "Hello, Lynx, you may pay 123456789 are you understand?";
var regExp:RegExp = /(d)((ddd)+)/g;
var temp:String = str;
while(regExp.test(temp))
{
temp = temp.replace(regExp, "$1,$2");
}
//but
trace(regExp.test(temp));//true??
The second Question:
Code:
//I need Lynx'Book, but I get Lynx''Book
var regExp:RegExp = /(?<=Lynx)(?=Book)/gi;
var str:String = "LynxBook";
trace(str.replace(regExp, ",'"));
|