Sorry, I think my question was poorly put. Here's what I'm trying to do.

I've created a class of buttons that when pressed animate to the centre of the screen and display a description of the item (see attached screenshot). What I'm having trouble with is determining which button is open and closing it when another button is pushed.

Here's own I'm calling the class (for testing purposes)
<abutton id="PWNButton" x="1200" y="100" theText="desc:/desc/PWN/text()" Logo="PWN" Site="http://www.yahoo.com"; ImageCalc="1.0350877193"/>

And here's the handler I was trying when a button is clicked

<handler name="onclick">
                Debug.write('Current open button = '+OpenButton);
                    if (OpenButton == null) {
                        OpenButton = classroot.id;
                        Debug.write('New open button = '+OpenButton);
                        classroot.OpenDisplay.doStart();
                        return;
                    } else {
                        OpenButton.CloseDisplay.doStart();
                        classroot.OpenDisplay.doStart();
                        OpenButton = classroot.id
                        Debug.write('New open button = '+OpenButton);
                    }
</handler>

The problem is that when I do this I get "TypeError: Cannot call method 'doStart' of undefined" - referring to OpenButton.CloseDisplay.doStart.

I suppose I could use a switch statement to decide which button is open by creating an open attribute but this also seems a little messy.

Thanks for your reply,

ignotus


On 11-03-05 01:31 PM, David Greisen wrote:
You use the id as a drop-in replacement for your variable.

<canvas>
<view id='firstview' visible='false' />
<script>
Debug.debug(firstview.visible)
</script>
</canvas>
prints false to the debug console.

On Fri, Mar 4, 2011 at 6:54 PM, Chris Janik <[email protected] <mailto:[email protected]>> wrote:

    Many times I've referenced an active view by opening them like so

    OpenBW = new lz.BigWindow(canvas, {x:xcor, y:10, width:wid});

    OpenBW = something like this <BigWindow>#3 /BigWindow

    after doing this I can refer to that view using the variable OpenBW.

    In a project I'm currently working on it would be pretty messy to
    spawn all of my views like the one above but I still would like to
    be able to reference them.

    How can I do this?

    I've tried to assign the Id of the view I want to control to a
    variable and I've also tried getUID but both of these return
    "TypeError: Cannot call method 'doStart' of undefined"

    Can someone please help

-- ignotus


<<attachment: ScreenCap.jpeg>>

Reply via email to