AC2 til AC3
Har denne kode til en søgefunktion i Flash, som jeg skal bruge. Problemet er bare at koden er lavet i AC2 og det skal laves som iPhone OS hvilket er AC3. Så tænkte på om det var muligt at ændre i koden så den fungere i AC3, og om der er nogen kan finde ud af dette?Indtil videre har jeg kun fundet ud af nogle småting som jeg kan finde ud af rette, som _root skal være: MovieClip(root), og onEnterFrame = function(){ skal være: addEventListener(Event.ENTER_FRAME,myFunction); function myFunction(event:Event) {
Anyhow, her er den originale kode:
stop();
var testText0:String = "Littering a dark and dreary road lay the past relics of browser-specific tags, incompatible DOMs, and broken CSS support. ";
testText0 += "Today, we must clear the mind of past practices. Web enlightenment has been achieved thanks to the tireless efforts of folk like the W3C, WaSP and the major browser creators.";
testText0 += "The css Zen Garden invites you to relax and meditate on the important lessons of the masters. Begin to see with clarity. Learn to use the (yet to be) time-honored techniques in new and invigorating fashion. Become one with the web.";
var testText1:String = "There is clearly a need for CSS to be taken seriously by graphic artists. The Zen Garden aims to excite, inspire, and encourage participation. To begin, view some of the existing designs in the list. Clicking on any one will load the style sheet into this very page. The code remains the same, the only thing that has changed is the external .css file. Yes, really.";
testText1 += " CSS allows complete and total control over the style of a hypertext document. The only way this can be illustrated in a way that gets people excited is by demonstrating what it can truly be, once the reins are placed in the hands of those able to create beauty from structure. To date, most examples of neat tricks and hacks have been demonstrated by structurists and coders. Designers have yet to make their mark. This needs to change.";
var testText2:String = "Graphic artists only please. You are modifying this page, so strong CSS skills are necessary, but the example files are commented well enough that even CSS novices can use them as starting points. Please see the CSS Resource Guide for advanced tutorials and tips on working with CSS.";
testText2 += "You may modify the style sheet in any way you wish, but not the HTML. This may seem daunting at first if you've never worked this way before, but follow the listed links to learn more, and use the sample files as a guide.";
testText2 += "Download the sample html file and css file to work on a copy locally. Once you have completed your masterpiece (and please, don't submit half-finished work) upload your .css file to a web server under your control. Send us a link to the file and if we choose to use it, we will spider the associated images. Final submissions will be placed on our server.";
var testText3:String = "Why participate? For recognition, inspiration, and a resource we can all refer to when making the case for CSS-based design. This is sorely needed, even today. More and more major sites are taking the leap, but not enough have. One day this gallery will be a historical curiosity; that day is not today.";
var found:Boolean = false;
onEnterFrame = function(){
if(_currentframe == 1){
var page:Number = 1;
}else if(_currentframe == 2){
var page:Number = 2;
}else if(_currentframe == 3){
var page:Number = 3;
}else if(_currentframe == 4){
var page:Number = 4;
}
}
var textArr = new Array();
textArr[0] = _level0.testText0;
textArr[1] = _level0.testText1;
textArr[2] = _level0.testText2;
textArr[3] = _level0.testText3;
function goPage(page){
_root.gotoAndStop(page);
}
var keyword = new Array();
_root.search.onRelease = function(){
_root.linkText = "";
for(j = 0; j < textArr.length; j++){
_level0["count"+j] = 0;
var p:Number = j+1;
keyword = textArr[j].split(" ");
for(i = 0; i < keyword.length; i++){
if(keyword[i].charAt(keyword[i].length-1) == ","){
l = keyword[i].lastIndexOf(",")-1;
wordmatch = keyword[i].substring(0,(l+1));
}else if(keyword[i].charAt(keyword[i].length-1) == "."){
l = keyword[i].lastIndexOf(".")-1;
wordmatch = keyword[i].substring(0,(l+1));
}else if(keyword[i].charAt(keyword[i].length-1) == "?"){
l = keyword[i].lastIndexOf("?")-1;
wordmatch = keyword[i].substring(0,(l+1));
}else{
wordmatch = keyword[i];
}
if(_root.searchTxt.toLowerCase() == wordmatch.toLowerCase()){
_level0["count"+j]+=1;
if(_level0["count"+j] <= 1){
_root.linkText += ("<a href=\"asfunction:goPage,"+p+"\">page "+p+" contains the word <font color=\"#FF0000\"><B><I>"+wordmatch+"</I></B></font></a><br />");
}
}
}
}
}
_root.greenbar.onRelease = function(){
_root.gotoAndStop(1);
}
_root.pinkbar.onRelease = function(){
_root.gotoAndStop(2);
}
_root.bluebar.onRelease = function(){
_root.gotoAndStop(3);
}
_root.orangebar.onRelease = function(){
_root.gotoAndStop(4);
}