|
|
|
#1 |
|
Junior Member
Join Date: Oct 2004
Posts: 2
|
Subservient Chicken
Hello All,
I'm sure everyone has seen the subservient chicken thing before: http://www.subservientchicken.com/ Basically, there are about 400 different clips of the chicken doing random things. Depending on what you type into the field, the flash will load the movie that has been labled with the corresponding attributes. I'm trying to accomplish something similiar in scope, where a keyword or phrase entered by the user would trigger or call a specific movie clip. Any ideas on where/ how to begin? Thanks in advance! |
|
|
|
|
|
#2 |
|
Senior Member
Join Date: Feb 2004
Location: Los Angeles
Posts: 2,920
|
One way to do it would be to have a movieclip that contains a number of different sections, each with a different label. When you issue
gotoAndPlay('dance'); or gotoAndPlay('jump'); It will jump to the appropriate label. At the end of the section there is a script that says gotoAndPlay('idle'); which jumps to back to a basic idle loop. To process the text, you can do something like:
Alternately, you can use a data structure for all your triggers and labels, enabling you to more easily define multiple triggers for each clip.
Last edited by jbum; 10-15-2004 at 06:27 PM. |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Jan 2005
Posts: 1
|
1) rather than going to a "label," how do I have it open up a .flv/.swf file when a keyword is triggered?
2) how do I have it import the actions, so that people cannot steal the swf? |
|
|
|
|
|
#4 |
|
Registered User
Join Date: Apr 2001
Posts: 1
|
Wild card character for text string?
Okay, this is a long shot, but it's worth posting, even if I get flamed for being a total newbie.
I'm interested in creating a v-e-r-y simple Question and Answer animation. A user types a Question into an input textfield, and whatever phrase and words they type, if in it is contained the word "fired," my answer would be to go to frame label FIRED and Answer = "You are so fired." Alternately, if it also contained the word "trouble", "late", "hate", (etc) it would still go to frame label FIRED and Answer = "You are so fired." Else it would go to a generic answer or prompt for another question. (I guess this is sort of like a magic eight ball meets subservientchicken...not 400 movie clips, but perhaps about answers relative to keywords typed) Anyway, rather than set up an array, is there asimple wild card character for text strings? Like, question = inputText if (question == ("*"+"fired"+"*")) { Answer = "You are so fired." ; } else { Answer = "You are on thin ice, ask again." ; } I realize this is a wish on my part (I have to publish in F6), perhaps to avoid massive arrays, functions, and math...but it's worth asking. This type of animation quiz or Q&A must have been done before but I can't seem to find it. Any suggestions? |
|
|
|
|
|
#5 | ||
|
Member
Join Date: Jan 2005
Posts: 42
|
Re: Wild card character for text string?
Quote:
Quote:
just a quick sample (didn't test): Code:
var findKeyword= function (txt:String, keywords:Array):Boolean {
for (var i:Number=keywords.length;i>=0;--i) {
if(txt.indexOf(" "+keywords[i]+" ")<>-1) {
return true;
}
}
return false;
}
//
var keywords:Array= new Array("fired", "trouble", "late", "hate");
var question:String="I am late";
if (findKeyword(question, keywords)) {
gotoAndPlay("fired");
} else {
gotoAndPlay("hired"):
}
|
||
|
|
|
|
|
#6 |
|
Junior Member
Join Date: Mar 2009
Location: UK
Posts: 9
|
waesrty
Last edited by Mayato; 04-23-2009 at 04:05 PM. |
|
|
|
|
|
#7 |
|
Member
Join Date: Mar 2009
Location: Brooklyn, NY
Posts: 75
|
I had to make one of these just a few months ago.
What I ended up doing was creating an XML file with the video to play node a level above the nodes of the words that would trigger the video. Basically: Code:
<vid toPlay="vid1"> <word>jump</word> <word>hop</word> <word>skip</word> </vid> |
|
|
|
|
|
#8 |
|
Junior Member
Join Date: Mar 2009
Location: UK
Posts: 9
|
23ert5yuiop
Last edited by Mayato; 04-23-2009 at 04:04 PM. |
|
|
|
|
|
#9 |
|
Junior Member
Join Date: Mar 2009
Location: UK
Posts: 9
|
qwertyujkl
Last edited by Mayato; 04-23-2009 at 04:04 PM. |
|
|
|
|
|
#10 |
|
Member
Join Date: Mar 2009
Location: Brooklyn, NY
Posts: 75
|
Sorry Mayato,
The XML thing was more for thinkinc who is going to be using a text input field. If you're just going to be using buttons then you could do something like this: Code:
button1.onRelease = function():Void
{
playTheMovie("sit");
}
button2.onRelease = function():Void
{
playTheMovie("stand");
}
button3.onRelease = function():Void
{
playTheMovie("hop");
}
function playTheMovie(flvPath:String):Void
{
yourFlv_instanceName.contentPath = flvPath;
yourFlv_instanceName.play();
}
|
|
|
|
|
|
#11 |
|
Junior Member
Join Date: Mar 2009
Location: UK
Posts: 9
|
I seem to be having this problem at the moment, i'm using CS4, currently Actionscript 3, and I'm getting this:
![]() ---------------- Now playing: Boards Of Canada - Smokes Quantity via FoxyTunes Last edited by Mayato; 04-26-2009 at 06:54 PM. Reason: Mistake. |
|
|
|
|
|
#12 | |
|
Junior Member
Join Date: Mar 2009
Location: UK
Posts: 9
|
Right, I've managed to read my way through that and fix it, now it's this:
**Warning** The linkage identifier 'FLVPlayback' was already assigned to the symbol 'movies/xxxxxxxx', and cannot be assigned to the symbol 'movies/xxxxxxxx', since linkage identifiers must be unique. When I select the properties for the video clips the Indentifier is grayed out and can't be changed. How do you create unique identifiers for video clips so there are no conflicts? Quote:
|
|
|
|
|
|
|
#13 |
|
Member
Join Date: Mar 2009
Location: Brooklyn, NY
Posts: 75
|
Ok, if you're using AS3 this is going to be a bit trickier. Because of how AS3 uses event listeners you can't just pass in a variable. If you have the time then now would be a good chance for you to read up on custom event managers so that you would be able to add parameters to your mouse events.
However, there is a work around that you can use. It's not the best way (the custom event manager would be the best), but it will work. What you want to do is something like this: Code:
button1.addEventListener(MouseEvent.CLICK, playTheMovie);
button1.addEventListener(MouseEvent.CLICK, playTheMovie);
button1.addEventListener(MouseEvent.CLICK, playTheMovie);
function playTheMovie(me:MouseEvent):void
{
switch(me.target.name)
{
case "button1":
yourFlv_instanceName.contentPath = "sit";
break;
case "button2":
yourFlv_instanceName.contentPath = "stand";
break;
case "button3":
yourFlv_instanceName.contentPath = "hop";
break;
case default:
yourFlv_instanceName.contentPath = "sit";
break;
}
yourFlv_instanceName.play();
}
|
|
|
|
|
|
#14 |
|
Junior Member
Join Date: Mar 2009
Location: UK
Posts: 9
|
I can now see the differences between AS2 and AS3, I'm tempted to jump back on to AS2, but I'd like to give this a go!
Last edited by Mayato; 04-26-2009 at 06:56 PM. |
|
|
|
|
|
#15 |
|
Junior Member
Join Date: Mar 2009
Location: UK
Posts: 9
|
Right, this is doing strange things, God help me!
|
|
|
|
|
|
#16 |
|
Member
Join Date: Mar 2009
Location: Brooklyn, NY
Posts: 75
|
ok...so it doesn't look like those instance names are matching up to buttons on the stage...any way you can post your .fla file? I'll look at it and then explain what to do with it.
|
|
|
|
|
|
#17 |
|
Junior Member
Join Date: Mar 2009
Location: UK
Posts: 9
|
Sure, i'll send the working .fla, is it just the fla you need?
Last edited by Mayato; 04-26-2009 at 06:57 PM. |
|
|
|
|
|
#18 |
|
Member
Join Date: Mar 2009
Location: Brooklyn, NY
Posts: 75
|
nah, just the fla should do
|
|
|
|
|
|
#19 |
|
Junior Member
Join Date: Mar 2009
Location: UK
Posts: 9
|
okay, thanks.
Last edited by Mayato; 04-26-2009 at 06:57 PM. |
|
|
|
|
|
#20 |
|
Member
Join Date: Mar 2009
Location: Brooklyn, NY
Posts: 75
|
Ok,
So I set up a quick example w 3 buttons and flv files...all the flv files look the same, but this is working. I went ahead and made a template file from scratch for you using the video object and NetConnection. This is a bit more advanced, but gives you much more control in the long run. I have commented the ActionScript in the file also, so that should help explain what is actually going on. Here are a couple of places to get good info for any questions with this: http://livedocs.adobe.com/flash/9.0/...onnection.html http://www.adobe.com/devnet/flash/qu...ta_cue_points/ You can download the files here: http://www.megaupload.com/?d=M202XO8T |
|
|
|
![]() |
|
||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|