Problem including mxml code

Ask a Question related to Macromedia Flex General Discussion, Design and Development.

  1. #1

    Default Problem including mxml code

    I want to keep my code clean and I would like to include my code in other
    seperate files.

    What would be the mxml script equivalent of an actionscript #include?

    I tired placing

    <Mypage />

    in my code that would refrence Mypage.mxml, but I get a URI error.

    Am I doing this wrong?

    meekgeek Guest

  2. Similar Questions and Discussions

    1. How does on Sharing data between main.mxml and a renderer.mxml
      I have a value set in my main mxml file. public var calDate:Date = new Date(); How can I use this value in my renderer mxml file? if...
    2. Need "View States/Transitions" tutorial MXML code
      Hello Flexers, I've been going through the Flex tutorials and have hit a roadblock in the 4th tutorial. I need the full MXML source code for the...
    3. including php code
      hi ist it possible to include php code in an swf, so that i can build up/change an dynamic link online? alex
    4. Can I embed external MXML in another MXML file?
      Hi - I'm new to this so please bear with me. I'm trying to do something like you do in JSP's with a JSP include where I can import prewritten code...
    5. Problem with including a header
      I have the following file structure: / header.asp test.asp /subDir testpage.asp /images I would like to have header.asp to be usable from...
  3. #2

    Default Re: Problem including mxml code

    meekgeek wrote:
    > I want to keep my code clean and I would like to include my code in other
    > seperate files.
    >
    > What would be the mxml script equivalent of an actionscript #include?
    >
    > I tired placing
    >
    > <Mypage />
    >
    > in my code that would refrence Mypage.mxml, but I get a URI error.
    >
    > Am I doing this wrong?
    >
    <Mypage xmlns="*"/> will read it in from the root level. Remember, Flex
    is all about XML namespaces.

    HTH,

    Jason


    --
    Jason Weiss
    Cynergy Systems, Inc.
    Macromedia Flex Alliance Partner
    [url]http://www.cynergysystems.com[/url]

    Email: [email]jason.weiss@cynergysystems.com[/email]
    Office: 866-CYNERGY
    Mobile: 1.832.444.2246
    Jason R. Weiss Guest

  4. #3

    Default Re: Problem including mxml code

    Thank you for your reply.

    I had the files under my /flex folder. Would the root level be the one on top
    of that?

    Also could you point me to some more info on xml namespaces?

    Any help would be greatly appreciated.

    meekgeek Guest

  5. #4

    Default Re: Problem including mxml code

    I believe in this context, "root" means the current folder, the one the
    application mxml file is in.

    You CAN use <mx:Script source="myFile.as" /> to include an actionscript file,
    but I do not reccomend it because of the 32k limit issues.

    Instead, create a "helper class" with the AS code in it. I typically have one
    for UI manipulation and one for data-oriented stuff. then, in the mxml file,
    do:
    <UIFunc id="ui" app={this}.../>

    And access your helper class members:
    ui.myPublicFunc();
    ui.myPublicVariable;

    Note I am passing a reference to the application scope into the class to make
    it easier to work with app-level members in the helper class. To do this,
    declare a public variable typed as the application name:
    public var app:MyAppFileName;

    Tracy

    ntsiii Guest

  6. #5

    Default Re: Problem including mxml code

    Ok, I found this. I think this might answer my question and anybody else that was wondering too.

    [url]http://www.cflex.net/showfiledetails.cfm?ChannelID=1&Object=File&object ID=291[/url]
    meekgeek Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139