A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: designing a dictionary application in AS3

  1. #1
    Junior Member
    Join Date
    Dec 2012
    Location
    Carlifonia
    Posts
    16

    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

  2. #2
    Senior Member
    Join Date
    Nov 2001
    Posts
    1,145
    What was the hangup? C# and AS3 are mostly the same?

  3. #3
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    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. -

  4. #4
    Junior Member
    Join Date
    Dec 2012
    Location
    Carlifonia
    Posts
    16
    Quote Originally Posted by cancerinform View Post
    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?

  5. #5
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    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. -

  6. #6
    Junior Member
    Join Date
    Dec 2012
    Location
    Carlifonia
    Posts
    16
    Quote Originally Posted by moot View Post
    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

  7. #7
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    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.CLICKcHandler);
    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. -

  8. #8
    Junior Member
    Join Date
    Dec 2012
    Location
    Carlifonia
    Posts
    16
    Quote Originally Posted by cancerinform View Post
    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.CLICKcHandler);
    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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center