This content has been marked as final. Show 18 replies
The code below uses two unique conditionals to pick left or right depending if the number is an even or odd. So it will make 2 vertical columns when completed. It will construct rows first versus columns.
Copy this code into a new FLA and watch the trace statements. Do you see how this can help you? If not just ask. Also these two links are for reference for those 2 conditional.
myIP, thanks a bunch for this pointer...
Never even thought of attacking my issue with modulus
or a similar approach.
What approach should I use in case I need a 3rd one?
Below is my current state and tryout. It worked ok but for one thing.
It does split my items in 2 columns. However creates an empty cell
on either "right" or "left" sides. Ex:
and so on.
I wasn't able to isolate var nextRow:Number = 10;
Any help would be appreciated =)
Copy the code below to have 3 columns.
The “nextRow” acts like a ‘return’ button, just like your keybroad for your computer. It will increase the value of _y (if you assign the value to it) each time it reaches the end of the row.
Suggested code worked almost like a charm. It did break my xml content in 3 colums.
However, I was never able break into correct horizontal rows.
I understand that _y and variable "i" is invoked each time an decals diagonaly the items...
Any suggs myIp? I would simply like it to break in perfect rows. I'm out of ideas.
(tried implementing with “nextRow” but simply applies the items over another without affecting my _y axis)
Thanks for helping out, it means a lot!
Hmmm…I don’t see how your ‘i’ is getting incremented in your last post. However, paste the code below into a new FLA. What you needed to do in my last code was to assign nextRow to your ‘_y’ property.
myIP, pm'd you
Go to this address: www.november7.ca/setItemOnStage.zip
You'll find an easy way to set item on stage. Just have to use your XML with.
Variable on top must be your. Number of items will depends on the number of XML nodes you have. For now I just put a number to test it.
Hopa that can help
Nixy, thanks for helping out with this very comprehensible example.
Again, it's nice to see another different approach for my issue.
Only wish I could integrate it correctly =L
I've tried implementing this for a couple of days within my app. and couldn't get it to work.
(All my items appeared over each other or it didn't retreive my xml correctly etc. )
Here is the isolated section of my script where I'm trying to get this working:
Please take a look at my link above this message,
all my source is there. You will be able to alter and view
the code easily and without confusion.
Sorry for the delay
Here is a link to download the new file : http://www.november7.ca/xml_StageHelpfolder.zip
The function used to display the submenu is all new. You'll see this part at the bottom of your document. I have change some little thing in the first part of your code, but nothing important. Just to undestand the way you've code that, only. I have separate the function "makeMenu" in 2 functions "makeMenu" and "makeSubMenu". It's a good practice to keep function simple.
If you have any question on how it works, let me know.
Also, just before the new function, at the bottom, there is many variables. You can use them to manage you submenu display. Distance between, number per column, etc..
Hopa that can help!
been figuring out how you implemented the code. Where it grabs and distributes etc. nice logic behind this... very clever function too!
somehow, once I click on the items no images can retreive from the xml.
I tried altering, adding from the old piece and nothing. no wizardry
think it might have to do with these older lines(.push & with):
levelTwoItems.push(levelTwoEmpty.attachMovie("levelTwoItem", "item" + i, i));
with (levelTwoEmpty["item" + i])
did put up a file with clean UI.
this is definitely the last blocking step
I just modify the code in the fla
You can download it there : New Doc here
I've put a new function at the bottom of your code that will allow you to add or modify submenu events. You'll find an example of the onRelease event. Actually it just trace the IMG tag. So you can change it to load the image or do whatever you want with.
Hope that can help.
nixy, I tried implementing the latest function in place but can't seem to assign the correct item values.
How can I combine you latest piece of code with my last part? Been having a hard day... not giving up tho ;)
Here it is: GET IT HERE
I have modified some part of each functions at the bottom. So change tehm all. Just those at the bottom. I also change the "makeSubMenu" function at the top of your code. In this function the parameters is now "node" and no more "node.childNodes". To long to explain, but it works perfectly now. When I change the code before I didn't thought that you wiil need the menu type. That is the reson why I need to keep the all the node not just the node.childNodes. Well at the bottom, here is what I did:
1- In the "attachSubMenuItem" the is a button id for each clip. Use to now wich subment have been clicked
2- I still use the "setSubmenuEvents" function even if the is only one event in. It's a good way to work in case of you'd like to add other events.
3- I had change a bit of your code in the "levelTwoEmpty["item"+i].onRelease" now named as "clickEventSub". Not just an event, but a function. Code inside has been modify to works with the new code. Also I use the switch case instead of the if else if else etc. In this case It<s a good way to works. Also actually the code for the id web or img is the same, so instead of having 2 different if, I put tehm in the same, actually the default value in the switch case.
Hope that can help.
this is working perfectly and without a glitch. Your coding skills are very impressive!
This post was a learning journey for me and I'm hoping to give back in return someday. With all respect for your help, time and contribution.
Merci énormément =)
nixy, everything ok but one bug I can't figure out. no text is pulled from the xml in the "last menu item". I added to your switch statement below for debuging. Assigning each xml item type correctly. If you place the xml below and retrieve in the flash piece with "viewArea" on stage, you'll notice that our xml text item can be shown without any trouble... any idea where this might be going wrong?
<menu name="Test5" type="text">
<![CDATA[Text text text]]>
<![CDATA[Text text text]]>
viewArea.textonly.textField.text = menuItems.childNodes[theMc.id].firstChild.nodeValue;
Again, thanks Nixy for your help and patience