RSS twitter

Creating and sending Flash INPUT fields

This tutorial demonstrates how to create an edit field and post it to an URL using query string. We will invoke Google search from our Flash document.

Minimum Flash Designer version: 5.0.21.2

Create INPUT field and “Search” button

  1. Launch Flash Designer and choose “Blank document” from the startup screen
  2. Choose “Edit Field” tool. Draw a new edit box. The item will appear as “Edit1″.
  3. Choose “Button” tool. Draw a new button. The item will appear as “Button2″.
  4. While the button is selected choose “Item” > “Edit Properties”. Rename the button to Search. Click OK.

Build a “query string” and send it to Google web site

Google search URL is “http://www.google.com/search” and the parameter is “q”. For example, if we want to search for “tutorials” the full URL would be “http://www.google.com/search?q=tutorials”.

Use the following ActionScript code:

System.Security.allowDomain("www.google.com");
searchURL = "http://www.google.com/search?q=" + Edit1;
getURL(searchURL,"_blank");

The first line builds search URL and the second line posts the URL to Google web site. If you want to display search results in the same window use “self” instead of “_blank” target.

  1. While the button is selected choose “Action” > “OnClick”. Select “ActionScript” option and enter above code:
  2. Select “enter” as the shortcut key and click OK.
  3. To prevent animation looping and clearing the edit field define the frame as static. Choose “Frame” > “Frame Delay” and check “Stop” option.

Finally export the animation.

  1. Choose “File” > “Export Flash SWF File” command. Name your swf file and click OK.
  2. Choose “File” > “Export Web Page”. The page should popup in a blank browser window.

Flash file and the web page

Download Flash Designer source project: here (0.6 kb)

Similar Posts:

4 Comments

  1. [...] link: Creating and sending Flash INPUT fields | Flash tutorial | Flash … Share and [...]

  2. WP Themes says:

    Nice dispatch and this enter helped me alot in my college assignement. Thank you as your information.

  3. karel rosseel says:

    hello I am trying but the zip download is only the file: t1003.sfd
    => please can you help me.

    => I am also searching for a flash-textbox where the google-results will come and be displayed.. do you have a solution for that?
    => When it should be possible I only need the header-link of the google search result to be displayed.. something like this module: http://www.ffiles.com/flash/web_applications_and_data/flash_search_894.html

    => and it should be possible to go right from the searchbox to “http://www.google.com” for example

    do you have a solution to make something like this?
    thanks for your reply
    Karel

  4. admin says:

    1) Build a animation (leave some space for the search box)

    2) Use ur Text Tool to build your Input Text while the Input Text is selected go to ur Properties and make sure it says Input Text if not then change it to Input Text on the type searchword then look at the VAR: section and type search
    now u r done with that section.

    3) Build a new shape square if u want to and then right click on that shape and click on Convert to Symbol
    the name donesn’t matter u can ether put search buttn or whatever u want but don’t use the search word at all on that new shape, make sure that the option Button is selected then click on OK
    now let`s build the code

    a)you need to indicate what key is going to be our trigger in this case lets use the ENTER “duh!”
    on (release, keyPress ““)

    b) now you have to indicate our variables and our variables are search
    text.search = “”;

    c)You have to indicate how or where we want the results so this is very simple we want it in the same page in our content area just like is meant to be.
    getURL (‘index.php?option=com_search&Itemid=5&searchword=
    there is where we want our results but is not finish yet we need to indicate what we want in there so lets add out word that we are looking for how? well lets just add our variable which is search so
    after the = we add “+search now lets add where we want it and we want it in the same window so lets put “_top” and in order to display the results we have to indicate our method “GET”
    finally our code should be looking something like this

    Code:

    on (release, keyPress ““) {
    text.search = “”;
    getURL(“index.php?option=com_search&Itemid=5&searchword=”+search, “_TOP”, “GET”);
    }

    If you want you can use full URL or just the index.php
    getURL(“http://www.yourdomain.com/index.php?option=com_search&Itemid=5&searchword=”+ search, “_TOP”, “GET”);

Leave a Reply