Monday, August 11, 2008

Flash Web Site About to Become Google / Yahoo Searchable!

I just found this article by SchoolOfFlash.com and they said the following. How exciting!!

-------

For years, the advice has always been that if you want good search engine results, then you don’t want to create your website entirely with Flash, because search engines have no way of effectively indexing swf files. Well, all of that is about to change.

Adobe, Google, and YahooAdobe just announced that they are teaming up with Google and Yahoo in order to address this issue. Adobe has supplied these search industry leaders with technology that will allow them to index swf files in a way that has never been possible before. In fact, Google has already started implementing this technology, and as I understand it, Yahoo won’t be too far behind.

“But wait,” you say. “I thought search engines already had a way to index swf files.”

Well, you’re right, but up until now, they could only index the static information and static links within your swf file. With this new technology, even the dynamic content of your Flash files will be open to search engine indexing, making it infinitely more possible for your all-Flash website to achieve top rankings in search engine results.

ActionScript 3 Music for Web Site

Here is what a friend of mine wrote and asked me along with the code that was giving him problems:

K dude... it's 4 in the morning, and I'm killing myself trying to get this stupid toggle button to work. I have the button working, I just can't figure out how to get the sound to stop and play with clicking the button. below is my code... could you take a look and see if you can figure out how to get the sound to stop and play... I tried to do this without asking to much of your help... lol...

stop();

var music:Sound = new Sound(new URLRequest("Equanimity.mp3"));
var sc:SoundChannel = music.play();
var isPlaying:Boolean = true;

//togglebtn.addEventListener(MouseEvent.CLICK, playSound);
//togglebtn.addEventListener(MouseEvent.CLICK, stopSound);
togglebtn.addEventListener(MouseEvent.MOUSE_OVER, rolloverToggle);
togglebtn.addEventListener(MouseEvent.MOUSE_OUT, rolloutToggle);
togglebtn.addEventListener(MouseEvent.CLICK, toggleClick);
togglebtn.buttonState="off";

function rolloverToggle(event:MouseEvent) {
togglebtn.gotoAndStop(togglebtn.buttonState+"_over");
}

function rolloutToggle(event:MouseEvent) {
togglebtn.gotoAndStop(togglebtn.buttonState);
}

function toggleClick(event:MouseEvent) {
if (togglebtn.buttonState == "on") {
togglebtn.buttonState = "off";
//not sure what code to put here to stop music
//function stopSound(event:)???
} else {
togglebtn.buttonState = "on";
//not sure what code to put here to play music
//function playSound(event:Event)???
}
togglebtn.gotoAndStop(togglebtn.buttonState+"_over");
}

function onWhoClick(evt:MouseEvent):void {
gotoAndStop("Who");
}
who_btn.addEventListener(MouseEvent.CLICK, onWhoClick);

function onWhatClick(evt:MouseEvent):void {
gotoAndStop("What");
}
what_btn.addEventListener(MouseEvent.CLICK, onWhatClick);

function onWhyClick(evt:MouseEvent):void {
gotoAndStop("Why");
}
why_btn.addEventListener(MouseEvent.CLICK, onWhyClick);





This was my response:



Let’s attack this by giving you the option of pausing or stopping: The playSong event listener will be added within a function below. I’m going to try and let you place this code where you think you need to (pretty easy in as3). Also, change the button names and function names to what then need to be. Functions are hard to write when you’re a beginner in the code J It’s hard to know the syntax. But it’s good that you knew you were supposed to write a function bc you have the logic and that’s where it starts. This language is SUPER hard because it’s all theoretical. It’s called object-oriented programming. You will NOT get it the first or second or even third time your try and go at it. It’s too vague and theoretical. It’s like you have to be thinking in the 4th dimension when it’s all waves… lol… it’s hard for realz J

pause_btn.addEventListener(MouseEvent.CLICK,pauseSong);
stop_btn.addEventListener(MouseEvent.CLICK,stopSong);

Then you need the functions:

function pauseSong(e:Event):void

{

pos = sc.position; //get the song position

sc.stop();//stops the song in its possition

songPlaying = false; //sets the flag to show that song is not playing with this Boolean statement (Boolean means that it’s either true or false)

play_btn.addEventListener(MouseEvent.CLICK,playSong); //add event list. to show look for a playSong on mouse click

}

function playSong(e:Event):void

{

if(songPlaying == false) //if song is not playing then run this function

{

sc = currentSound.play(pos); //find the current song position

sc.addEventListener(Event.SOUND_COMPLETE, nextSong); //I don’t know if you have a next song, but in case you do, here’s how to look for it

songPlaying = true; //set song playing to true

play_btn.removeEventListener(MouseEvent.CLICK,playSong); //remove event listener for playing song since you don’t need to look for a song playing

}

}

function stopSong(e:Event):void //I’m sure you can get this function on your own since it’s the same as the play function just backwards

{

sc.stop();

pos = 0;

songPlaying = false;

play_btn.addEventListener(MouseEvent.CLICK,playSong);

}