flash (macromedia):
I'm trying to generate a PopUp from a datagrid upon "cellPress". The motive is to generate a PopUp on cellPress event of the datagrid, to display the detailed view of the selectedItem. While the PopUp is created perfectly, the fields to be displayed in the PopUp appear with true values sometimes & with the "undefined" value sometimes.. for example, a textarea displaying the record desciption field of the selectedItem shows the exact value read from the database record SOMETIMES.. Rest of the time, it displays the event description field as "undefined" in the textarea.. Please help me out with this...
Hi i jus came across ur post while searchin for an answer to this question. but i am unable to generate the pop up yet. was wonderin if u found an answer to this problem and if u could share some light on it. thanks for any help available.
hey ppl... does anyone know how the selected data from one movie clip wud be passed to another? i.e. datagrid to new movieClip
J465, [quoted text, click to view] > i jus came across ur post while searchin for an answer to this question. > but i am unable to generate the pop up yet. > was wonderin if u found an answer to this problem and if u could share > some light on it.
This post seems to be floating on its own. It's unclear now to which thread this belongs. Can you spell out the exactl problem you're having? David stiller (at) quip (dot) net "Luck is the residue of good design."
J465, By the sounds of it, you'll need ... [quoted text, click to view] > i would hav a set up of the movieClip that the selection > would load into within my library...
.... a movie clip set up in your Library. This clip will need a Linkage id (right click on the Library asset to set this) so you can use MovieClip.attachMovie() to attach the clip the Stage when needed. [quoted text, click to view] > but the content that would appear within it wud be > dependant on that thats been selected from the datagrid.
.... you'll need to know which cell was selected in your DataGrid instance. Dig into the ComboBox class to look for available methods and properties. DataGrid is made up of a series of lists, and List.selectedIndex gives you the selected index. There's more to it than that, so you'll have to play goose chase, a bit. I haven't touched DataGrid in a while, but if you Google it, I'm sure you'll find a tutorial. Once you derive the contents of the selected cell, you'll be able to pass that data along to the text fields by their instance names in the desired movie clip. David stiller (at) quip (dot) net "Luck is the residue of good design."
yep.... im tryin to load a movieClip depending on the selection i make from the datagrid. and then for this movieClip to hold the information from the datagrid in textfields. i would hav a set up of the movieClip that the selection would load into within my library... but the content that would appear within it wud be dependant on that thats been selected from the datagrid. i hope that clears it up. thanks for any help on offer.
Hey thanks for the reply. yeh im more or less up on the theory of how it shud work.. n im tryin to take it step by step. but i dont actually no how to put the attachMovie within the cellPress call (which is where im stuck at the mo) without the cellPress i usually do this: this.createEmptyMovieClip ("mc_holder", 0); mc_holder.attachMovie ("mc", "mc", 0); which creates sumwhere for me to put the movieClip and then puts it there. but puttin it in the cellPress isnt the rite way to do it im sure... so any help on that? var details = new Object(); details.cellPress = function(evt){ this.createEmptyMovieClip ("mc_holder", 0); mc_holder.attachMovie ("mc", "mc", 0); this trace allows me to output column data into an output window trace(mens_dg.getItemAt(evt.itemIndex).colName) } datagrid.addEventListener("cellPress", details); the above doesnt work
woohoo... got the attach movieClip to work from the cellPress... gues its jus the hard bit to put the data into the fields now : (
Hi david.. thanks for all ur replys! maybe i shud hav told u where i had got to b4 i asked my question. ive been throu the code u jus showed b4.. but becos i want to retrieve the info in a dif movie clip is where the problem is. this is what i hav _root.createEmptyMovieClip ("info_holder", 4); var details = new Object(); details.cellPress = function(evt){ _root.info_holder.attachMovie ("info_mc", "info_mc", 4); info_txt.text = mens_dg.getItemAt(evt.itemIndex).Price; } mens_dg.addEventListener("cellPress", details); this allows me to display the cellPress data on the same movie clip as the datagrid! so if i was to move the info_txt box to the info_mc movie clip how wud i be able to retrieve the info there. wud i need sum form of loadin code when info_mc opens to recognise the cellPress from the other movieClip and then pull it into this one? i think thats the rite way to go about it. but i jus dont no how to do it!
fair enough i gues. not a lot i can say to that.. in answer to what your saying though. yes the mens_dg is scoped to my details object i thought i explained the picture pretty well in my last post. and after some more testing. this does work: _root.createEmptyMovieClip ("info_holder", 4); _root.info_holder.attachMovie ("info_mc", "info_mc", 4); _root.info_holder.info_mc._visible = false; var details = new Object(); details.cellPress = function(evt){ _root.info_holder.info_mc._visible = true; _root.info_holder.info_mc.price_txt.text = mens_dg.getItemAt(evt.itemIndex).Price; } mens_dg.addEventListener("cellPress", details); whereas this dont: _root.createEmptyMovieClip ("info_holder", 4); var details = new Object(); details.cellPress = function(evt){ _root.info_holder.attachMovie ("info_mc", "info_mc", 4); _root.info_holder.info_mc.price_txt.text = mens_dg.getItemAt(evt.itemIndex).Price; } mens_dg.addEventListener("cellPress", details); do you know any reasons for that? thanks for your time.
thats fine. i'll do my best to write correct constructive sentences. i'll try and spell out the whole scenario better. mens_ mc is the movie clip where my datagrid is mens_holder is the empty movie clip i created to load mens_mc in mens_dg is the datagrid thats in mens_mc on clicking this datagrid (mens_dg) im goin to load a new movie clip this movie clip is called info_mc info_mc loads into a movie clip called info_holder in info_mc i hav a textfield called info_txt which is where i want the information from the cellPress in mens_dg to be displayed. so at the moment: // i create my movie clip to hold attach info_mc to. _root.createEmptyMovieClip ("info_holder", 4); var details = new Object(); details.cellPress = function(evt){ //on cellPress i would load my new movie where i wil want the selection to be placed. and thats as far as i am really. _root.info_holder.attachMovie ("info_mc", "info_mc", 4); //this following line would allow me to view the cellPress but in the same movie clip i.e. mens_mc (which is where mens_dg is) info_txt.text = mens_dg.getItemAt(evt.itemIndex).Price; } mens_dg.addEventListener("cellPress", details); so i dont know how to fill the textfield in info_mc what i was thinking is: when i load info_mc would i need some form of loading code within that movie Clip that would recognize the cellPress from mens_dg and then tell it to put that into the textfield on info_mc i cant think of how else it would work? i hope that explains it better. i totally understand that its confusing. so thanks for being patient and trying to help :-)
[quoted text, click to view] > in info_mc i hav a textfield called info_txt which is where i > want the information from the cellPress in mens_dg to be > displayed.
To me, this means the path to your text field, so far, is this ... info_mc.info_txt; .... and in this line ... _root.info_holder.attachMovie ("info_mc", "info_mc", 4); .... you're attaching info_mc into another movie clip with the instance name info_holder, which means the path to your text field now is this ... _root.info_holder.info_mc_.info_txt; .... so when you invoke your text field's .text property, here ... info_txt.text = mens_dg.getItemAt(evt.itemIndex).Price; .... you need to correctly path to it. From the point of view of your details object (which is in the _root, I believe), there is no info_text anything. You're currently scoped to that object (details), and details has no such text field inside it. Instead, you need to correctly path to the text field you have in mind, as shown a few lines above. Also, I can't tell if you're confusing symbol names (what you see in the Library) with instance names (what you see in the Properties panel), which must be unique for each instance. David stiller (at) quip (dot) net "Luck is the residue of good design."
yep... those were the lines that i was initially thinking but: _root.createEmptyMovieClip ("info_holder", 4); var details = new Object(); details.cellPress = function(evt){ _root.info_holder.attachMovie ("info_mc", "info_mc", 4); _root.info_holder.info_mc.info_txt.text = mens_dg.getItemAt(evt.itemIndex).Price; } mens_dg.addEventListener("cellPress", details); which i think you were saying to do.. doesnt work :-( and im guessing that means your all out of ideas? im not sure what you was refering to about the 'details' bit though.. details was just the name i gave for the listener.
J465, [quoted text, click to view] > does anyone know how the selected data from one movie clip wud > be passed to another? i.e. datagrid to new movieClip
The DataGrid class features quite a number of methods and properties. Check out this: var dgListener = new Object(); dgListener.cellPress = function(evt:Object):Void { trace(evt.itemIndex + ", " + evt.columnIndex); }; dg.addEventListener("cellPress", dgListener); By creating a generic listener object, you can assign it a cellPress event handler whose function will receive an event object (arbitrarily named evt). This evt object has properties including itemIndex and columnIndex, which show you which cell was clicked. The above example gives you 0,0 for the upper left hand cell, 0,3 for the upper right hand cell in a three-column grid, 3,3 for the lower right hand cell in a three-column grid, etc. If you know the column name of the cell you're looking for you, can do something like this: trace(_root.dg.getItemAt(evt.itemIndex).columnName); That at least gives you a nudge. David stiller (at) quip (dot) net "Luck is the residue of good design."
J465, [quoted text, click to view] > maybe i shud hav told u where i had got to b4 i asked my question. > ive been throu the code u jus showed b4.. but becos i want to retrieve > the info in a dif movie clip is where the problem is.
I'm sorry, I have a really hard time sifting through the misspellings and abbreviations. I don't intend anything mean by saying that, but I deal much better in standard English. ;) [quoted text, click to view] > details.cellPress = function(evt){ > _root.info_holder.attachMovie ("info_mc", "info_mc", 4); > info_txt.text = mens_dg.getItemAt(evt.itemIndex).Price; > }
In the very least, I'm seeing that you use attachMovie to put a new mc instance into an instance called info_holder. That's fine. Then in your next line, you're addressing the .text property of something called info_txt. I would have thought you'd be addressing the movie clip you just attached, since that's your popup, right? You're not proving me the details I need in order to help you, I'm afraid. I just can't "see" the layout of your project in my mind. David stiller (at) quip (dot) net "Luck is the residue of good design."
J465, [quoted text, click to view] > _root.info_holder.info_mc.info_txt.text = > mens_dg.getItemAt(evt.itemIndex).Price; > } > mens_dg.addEventListener("cellPress", details); > > which i think you were saying to do.. doesnt work :-(
You've got a lot going on here. This could take a very long time to troubleshoot, and your biggest issue, I believe, is that you're not familiar with basic mechanisms like pathing to objects. In the above, you're patthing correctly to the text field (at least, I believe you are), but I wonder if you're pathing correctly to the DataGrid instance. Is there a mens_dg scoped to your details object, or is mens_dg also somewhere else? You see where this is going? :) [quoted text, click to view] > and im guessing that means your all out of ideas?
Not at all. :) I just can't see the whole picture. [quoted text, click to view] > im not sure what you was refering to about the 'details' bit though.. > details was just the name i gave for the listener.
You named your listener object "details," which is absolutely fine, but for example, I'm not sure you grasp what an instance of the Object class is capable of and what scope means ... concepts that are fundamental to what you're aiming for. I think your goal is a fairly complex one, but I'm not sure you "know the ropes yet," you know what I mean? In other words, I could keep giving you hints here, piece by piece, but when would you have that "Aha!" moment and know how to pick it up from there? David stiller (at) quip (dot) net "Luck is the residue of good design."
if i did a trace within the movieClip that mens_dg is in, it wud obviously find it. and if i did a trace to mens_dg in the new movieclip thats opening from the cellPress it wudnt find it. thanks for taking time out to reply all these times.
[quoted text, click to view] > if i did a trace within the movieClip that mens_dg is in, it wud > obviously find it.
Sure, but that's not what I suggested. [quoted text, click to view] >> I would add a trace() statement to the details.onPress event >> handler, trace(mens_dg), to find out of that object sees the >> mens_dg instance. See if you get undefined. > and if i did a trace to mens_dg in the new movieclip thats > opening from the cellPress it wudnt find it.
That's just it ... if you did a trace() *to* mens_dg it *would* find it. That's what I'm getting at. trace() can be a tool to help you discover whether or not you're correctly pathing to your various objects, movie clips, etc. It isn't always easy to "see" where things are in relation to each other, so pathing is an issue. It's a common here in the forum, when people suggest something "isn't working." [quoted text, click to view] > thanks for taking time out to reply all these times.
No problem. :) David stiller (at) quip (dot) net "Luck is the residue of good design."
ok. i can do a trace on my new movie clip. and if i _root to the mens_dg along its path it wil recognise it. but i'm not convinced the path is the problem, because of the examples shown before. (or do the examples shown before jus convice you that that is the problem?) another case about the movie clip having to be loaded first can be seen in this example. _root.createEmptyMovieClip ("info_holder", 4); var details = new Object(); details.cellPress = function(evt){ if (!_root.info_holder.info_mc)_root.info_holder.attachMovie ("info_mc", "info_mc", 4); _root.info_holder.info_mc.price_txt.text = mens_dg.getItemAt(evt.itemIndex).Price; } mens_dg.addEventListener("cellPress", details); with the above. when i click the datagrid it opens the new movie clip but doesnt fill in the textfield. if i click the datagrid again because the movieclip has already loaded it wil fill the textfield on the second click.
i know what your getting at with all the traces! but when they arent showing me any errors of my ways and only the results required you can understand my frustration. taking it back to this _root.createEmptyMovieClip ("info_holder", 4); var details = new Object(); details.cellPress = function(evt){ _root.info_holder.attachMovie ("info_mc", "info_mc", 4); _root.info_holder.info_mc.price_txt.text = mens_dg.getItemAt(evt.itemIndex).Price; trace(_root.info_holder.info_mc.price_txt.text) } mens_dg.addEventListener("cellPress", details); the trace does show my 'price' but it doesnt populate into my textfield component :( so i tested it with a dynamic text field instead (which i cant believe i havent tried yet) and it worked!! but i did want it to be in a nice textfield component :( and that stil dont really explain why the other code was allowing it to populate into the textfield component (but requring 2 clicks. one to load the mc and then one to populate the textfield)
Yeh my mistake. i guess im silly to presume you knew what i was refering to with the textfields. i was so caught up in the person who posted the initial message was trying to do what i was, that i just never thought. anyway thanks for the tip to wait for the components to load but i dont think i even know how to do that... and sittin here now i cant even think of it. (guess im just showing that i dont "no the ropes yet")
[quoted text, click to view] > in answer to what your saying though. yes the mens_dg is > scoped to my details object
I would add a trace() statement to the details.onPress event handler, trace(mens_dg), to find out of that object sees the mens_dg instance. See if you get undefined. [quoted text, click to view] > i thought i explained the picture pretty well in my last post.
I'm not criticizing what you've explained, only stating that it isn't enough for me to fully "get" what you're doing. :) [quoted text, click to view] > and after some more testing. this does work: <snip /> > whereas this dont: <snip />
I agree, that doesn't make sense. Based on the code you've shown, I don't see why that one movie clip should have to be attached first from outside the event handler. If we worked in the same office, I imagine the two of us could sit down, look at the whole thing, and figure it out. I wish I could provide more input for you. David stiller (at) quip (dot) net "Luck is the residue of good design."
[quoted text, click to view] > i'm not convinced the path is the problem, because of the > examples shown before. (or do the examples shown before > jus convice you that that is the problem?)
Your subject line is '"undefined" returned in PopUp,' which tells me you're getting an "undefined" notice somewhere. undefined means something has no value (yet), which can be caused by an incorrect path. I'm not convinced of anything yet, just searching for the right questions to ask. :) <snip> [quoted text, click to view] > if (!_root.info_holder.info_mc)_root.info_holder.attachMovie ("info_mc", > "info_mc", 4); > _root.info_holder.info_mc.price_txt.text = > mens_dg.getItemAt(evt.itemIndex).Price;
</snip> [quoted text, click to view] > with the above. when i click the datagrid it opens the new movie > clip but doesnt fill in the textfield.
If this were happening to me, I would use trace(), again, as a debugging/troubleshooting tool. I would trace(_root.info_holder.info_mc.price_txt); and make sure there is, in fact, a text field at the given location. I might pre-populate the text field and try to trace its .text property to make sure I could access it. I think my main point in all these posts is to encourage you to use troubleshooting techniques when you get stuck. The Debugger panel is slow, but very helpful, and trace() is great for this. David stiller (at) quip (dot) net "Luck is the residue of good design."
[quoted text, click to view] > i know what your getting at with all the traces! but when > they arent showing me any errors of my ways and only the > results required you can understand my frustration.
If a trace() shows you undefined when it you expect it to show you an instance or variable, the trace() does indeed show the error of your ways. When a trace() shows the value of a variable and the value is different from what you expected, it shows you the error of your ways again. :) [quoted text, click to view] > so i tested it with a dynamic text field instead (which i cant > believe i havent tried yet) and it worked!!
This is the first time -- in all these posts -- that I understand you're trying to use a UI Component (presumably TextArea or TextInput). You've been saying "text field" all along. It *may* be that you're not waiting long enough for the UI Component to initialize. Many of them require one frame to transpire before they're ready for input. You might try a single-frame onEnterFrame loop to "wait" for the Component to catch up. [quoted text, click to view] > and that stil dont really explain why the other code was > allowing it to populate into the textfield component (but > requring 2 clicks. one to load the mc and then one to > populate the textfield)
Actually, what I just mentioned may be the solution, and it would explain everything. This goes back to what I mentioned earlier about using standard English and communicating well. Even now, you said "textfield" again, instead of TextArea or TextInput -- and those items are completely different. Clarity makes a big difference, eh? ;) David stiller (at) quip (dot) net "Luck is the residue of good design."
J465, [quoted text, click to view] > anyway thanks for the tip to wait for the components to load > but i dont think i even know how to do that... and sittin here > now i cant even think of it.
You can use the MovieClip.onEnterFrame event handler to wait for a single frame to pass. someMovieClipInstance.onEnterFrame = function() { // instructions here (do something) delete this.onEnterFrame; } [quoted text, click to view] > (guess im just showing that i dont "no the ropes yet")
Believe me, if you learned the ropes first, you'd encounter less frustration. That, and trying to be as clear as possible when asking for help. :) David stiller (at) quip (dot) net "Luck is the residue of good design."
Don't see what you're looking for? Try a search.
|