HaxeFlixel / HaxeFlixel/flixel-ui

getAsset() can't find widgets that are inside a tab_menu

Open
#94 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Haxe
Stars
201
Forks
75
PR merge metrics
No merged PRs in 30d

Description

Using the XML file below the following code always prints three nulls. However, the XML is rendered correctly, the widgets are there, and calling getAsset("settings") for example works. I assume that getAsset() fails when it has to fetch a widget that's within a group.

trace(_ui.getAsset("name", true));
trace(_ui.getAsset("bgColor", true));
trace(_ui.getAsset("gridColor"));
<?xml version="1.0" encoding="utf-8" ?>
<data>
    <include id="global"/>

    <tab_menu id="tabs" center_x="true" center_y="true" width="70%" height="70%">
        <tab id="settings" label="Settings"/>
        <tab id="layers" label="Layers"/>
        <tab id="entities" label="Entities"/>
        <group id="settings">
            <input_text id="name" x="20%" use_def="inputText" text="New Project" />
            <input_text id="bgColor" x="20%" use_def="inputText" text="0x000000" />
            <input_text id="gridColor" x="20%" use_def="inputText" text="0xffffff" />
            <text id="dName" x="10" text="Project Name" />
            <text id="dBgColor" x="10" text="Background color" />
            <text id="dGridColor" x="10" text="Grid color" />

            <align axis="vertical" spacing="10" resize="false">
                <bounds top="10" bottom="25%"/>
                <objects value="dName,dBgColor,dGridColor"/>
                <objects value="name,bgColor,gridColor"/>
            </align>
        </group>
        <group id="layers">
        </group>
        <group id="entities">
            <input_text id="width" x="50%" use_def="inputText" text="16" />
            <input_text id="height" x="50%" use_def="inputText" text="16" />
            <input_text id="limit" x="50%" use_def="inputText" text="-1" />
            <input_text id="color" x="50%" use_def="inputText" text="0xff0000" />
            <text id="dWidth" x="40%" text="Width" />
            <text id="dHeight" x="40%" text="Height" />
            <text id="dLimit" x="40%" text="Limit" />
            <text id="dColor" x="40%" text="Color" />

            <align axis="vertical" spacing="10" resize="false">
                <bounds top="10" bottom="50%"/>
                <objects value="width,height,limit,color"/>
                <objects value="dWidth,dHeight,dLimit,dColor"/>
            </align>
        </group>
    </tab_menu>
</data>

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the getAsset() entry point and reproduce the issue using the XML example in this report. Trace lookup behavior for the name, bgColor, and gridColor widgets inside the settings group, then verify that these calls no longer return null while the existing settings lookup still works.

Written by the indexing model from the issue text.

Assessment

Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.