What's wrong with this code (search feature)

Hi the code that doesn´t works is this:


on (release, keyPress “<Enter>”) {
if (searchinput=123456) {
gotoAndPlay(“Scene 2”, 1);
} else {
gotoAndPlay(“Scene 3”, 1);
}
}


This is the code of the button that should trigger a search feature to reach a specific scene and frame by entering a number, in this case the number that should be entered to reach scene 2 frame 1 is “123456” and “searchinput” stands for the instance name of the input text field of the form. If other number or no number is entered in the input field you should be taken to scene 3, frame 1.

what’s wrong with this code and how I can fix it?

Please help,

daghost

:hair:

Pd: Previos message about what type of search I want to create:

Imagine scene 1 frame 1 of my movie has a search box (which I don’t know how to do) and I have a picture in scene 2 frame 14, another in scene 3 frame 10 and another in scene 4 frame 17.

I want to be able to do a search, let’s say, for the number 532 and as a result be taken to the scene and frame where my first picture is (scene 2 frame 14), then if I do a search for the number 568, as a result, be taken to the scene and frame where my second picture is (scene 3 frame 10) and if I do a search for the number 599, as a result, be taken to the scene and frame where my third picture is (scene 4 frame 17). As an addition to this, let’s say that I write a number that doesn’t exist, I should be taken to an error screen, let’s say that this error screen is at scene 5 frame 1.

This way it will work as a search feature to reach a specific scene-frame quickly by doing a search for a specific term (number).

What I need is to know how to create the search box and it’s trigger button (including the actions that should be applied)

Okay… So what you are trying to say is that you want to be able to create a databasing type feature for Flash…

The bad part about your decision though is that the wya you are doing this would take incredibly long to load up the entire movie…

If you want me humble opinion I wouldn’t use the style you defined… I would do something like this instead.

[AS]
on (release)
{
if (searchinput >= 0 && searchinput <= numphotos)
{
photo = “image” + searchinput + “.jpg”;
_root.photoHolder.loadMovie(photo);
} else {
// Bad Search…
}
}
[/AS]

Using this method… You can have a variable (numphotos) hold the amount of photos your database has… Each photo will have a name image1, image235… Etc… Etc… Then you can just dynamically load in each photo and each one is selected :wink:

Hope this helps you out some :slight_smile:

BTW… photoholder is just a empty movieclip placed on the main movie.

playamarz :player:

To create the search box and the button you push… Just make a textfield box…

Make this box an input type… And in the field where it says var… make that searchinput.

Then just make a movieClip and put the above code I gave you inside of that movieclip… This movieclip will be your trgger button.

playamarz :player:

Thanks for trying to help, but I don’t have a database, I mention the elements I will search for are pictures just as an example.

What I need is something like a shortcut to a specifict scene and frame. When I type a number in the input field and the number is related to a specific scene and frame in the code of the button I should be taken to that specific frame in that specifict scene.

Is like having a catalog where every scene is a different category and every frame inside the scenes are different products.

By the search feature I should be able to reach a specific product (scene - frame) just by typing a number (this way I won’t have to navigate the whole catalog looking for what I want.

If you can help me, please reply

daghost

:hair: