-
designing a dictionary application in AS3
Hello guys,
Recently I thought about designing a dictionary application in AS3 but wasn't able to get through with it. We already have one in c# but the project at hand requires it in AS3. Anyone with an idea?
Your suggestions would be appreciated.Thanks
-
What was the hangup? C# and AS3 are mostly the same?
-
Senior Member
You should make use of the Dictionary class, because you can associate one string to another and delete items easily.
var englishGerman = new Dictionary();
englishGerman["German"] = "Deutsch";
trace(englishGerman["German"] == "Deutsch");//true
trace(englishGerman["Deutsch"] == "Deutsch");//false
delete englishGerman["German"];
trace(englishGerman["German"] == "Deutsch");//false
May be that can help you in creating a Dictionary.
- The right of the People to create Flash movies shall not be infringed. -
-
Originally Posted by cancerinform
You should make use of the Dictionary class, because you can associate one string to another and delete items easily.
var englishGerman = new Dictionary();
englishGerman["German"] = "Deutsch";
trace(englishGerman["German"] == "Deutsch");//true
trace(englishGerman["Deutsch"] == "Deutsch");//false
delete englishGerman["German"];
trace(englishGerman["German"] == "Deutsch");//false
May be that can help you in creating a Dictionary.
Thanks for the code Cancerinform but why German? I intended for it to be an english dictionary or is there something i need to know?
-
Senior Member
That was just an example. Of course you can associate anything.
var dicictionary = new Dictionary();
dic["to laugh"] = "load expression of enjoying something";
trace(dic["to laugh"]);//load expression of enjoying something
- The right of the People to create Flash movies shall not be infringed. -
-
Originally Posted by moot
What was the hangup? C# and AS3 are mostly the same?
The dictionary app is supposed to function like a search engine which after a word is typed and a search button is pressed,it generates the meaning of the typed word. The c# was a group thing and no longer in my hands.
I would like to do it AS3 rather-kind of like a from scratch thing.i wont mind your assist.
thanks
-
Senior Member
You probably have no other choice than to make a MYSQL database with one table for each letter and then connect that to your movie using php. You can use of course XML files, but they will be very large. However it's a hell of a work.
Another possibility is to connect to an online dictionary, for example http://www.thefreedictionary.com/. You just add the searchword to the end of the url:
http://www.thefreedictionary.com/laugh
PHP Code:
import flash.net.navigateToURL; import flash.net.URLRequest; import fl.controls.Button; import fl.controls.TextInput;
var searchBut:Button; var searchField:TextInput; searchBut.addEventListener(MouseEvent.CLICK, cHandler); function cHandler(event:MouseEvent):void { var searchItem:String = searchField.text; if(searchItem != null) { navigateToURL(new URLRequest("http://www.thefreedictionary.com/"+searchItem)); } else { trace("Enter search word."); } }
- The right of the People to create Flash movies shall not be infringed. -
-
Originally Posted by cancerinform
You probably have no other choice than to make a MYSQL database with one table for each letter and then connect that to your movie using php. You can use of course XML files, but they will be very large. However it's a hell of a work.
Another possibility is to connect to an online dictionary, for example http://www.thefreedictionary.com/. You just add the searchword to the end of the url:
http://www.thefreedictionary.com/laugh
PHP Code:
import flash.net.navigateToURL; import flash.net.URLRequest; import fl.controls.Button; import fl.controls.TextInput;
var searchBut:Button; var searchField:TextInput; searchBut.addEventListener(MouseEvent.CLICK, cHandler); function cHandler(event:MouseEvent):void { var searchItem:String = searchField.text; if(searchItem != null) { navigateToURL(new URLRequest("http://www.thefreedictionary.com/"+searchItem)); } else { trace("Enter search word."); } }
Hmm.... that's a good idea.I would explore both and see which option would best suit the project bearing in mind that the online resource cannot be used offline but it is a good one and worth trying. Thanks a lot.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|