Pregunta

I've got one class, that describes UI in mxml and another that holds logic in as.

Is there some way, how to change UI via changing mxml based on the value of some variable in my actionscript class?

The as class looks like this:

public class SomeDialog extends MyDialog
{
public function SomeDialog(noteToTask:Boolean=false)
{
    this.noteToTask=noteToTask;
    resizable = false;
}

    // WHEN noteToCase is true, add to mxml some component, ie a button
private var noteToCase:Boolean;

override protected function createView():MyDialog
{
    var view:SomeDialogView  = new SomeDialogView ();
    return view;
}
}
¿Fue útil?

Solución

first, simple solution: make noteToCase public static bindable (if it can be static), and bind visibility, etc in mxml.

second, cleaner: create a viewmodel for your mxml, either in as, either in script, in the viewmodel you can use addElement, etc on your mxml, and call the viewModel when noteToCase changes, etc via a setter.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top