Copy link to clipboard
Copied
Hi,
Flash CS5 AS3
Datagrid has 1 row per bus service with settlement names in the cells that display MC's of sttmnts with user rollover. Last two columns are URL's. First column is the service number which doesn't have an associated MC.
We have gone from using Rollover to display sttmnts per service row to click, both have pros and cons on user experience, but to resolve the cons and get the best of both worlds we now wish a rollover to show MC's followed by a click to hold the user choice of a certain row else as they move mouse cursor over grid to get to Magnify button they change the MC's on show again !
using ROLL_OVER function before ITEM_CLICK was my approach but what code is needed to stop ROLL_OVER re-occuring again for this datagrid as after the click any movement across datagrid loses the selection displaying MC's for any row hovered !
Maybe we also need a reset button incase user changes their mind or have it that to click again the service row unselects it.
What is best here, reset button or click to unstick and how is it coded ?
Note that the user can then navigate from Level2 County View of map by clicking on a Level3 button into Level3 District view, where the same datagrid shows up, and needs to be able to maybe rollover again should they wish to reconsider their choice, perhaps the reset button would be good ! The initial view on arrival at Level3 should have their bus service selection still showing, this time with the Level3 MC's for it showing. We have code that appends _Level2 or _Level3 to the dg output depending on if they are at Level2 or Level3.
our code for the dg selections, first is by the way for activating the last two columns url's. :-
dg.addEventListener(ListEvent.ITEM_CLICK,dgClickF);
function dgClickF(e:ListEvent):void{
//trace(e.columnIndex, e.rowIndex)
//trace("Focus has left row: " +e.rowIndex + " col: " + e.columnIndex)
if (e.columnIndex == 6 || e.columnIndex == 7){
var cellData = e.target.columns[e.columnIndex].itemToLabel(e.target.getItemAt(e.rowIndex));
//trace(cellData)
var url : String = cellData;
var targetURL:URLRequest = new URLRequest(url);
navigateToURL(targetURL,"_blank")};
}
dg.addEventListener(ListEvent.ITEM_ROLL_OVER,ShowTempSymbols);
function ShowTempSymbols(e:ListEvent):void{
makeAllVisibleF(false);
var r:RegExp = /\W/g;
for(var s:String in e.item){
//trace(currentLevel)
if(e.item){
var clipName :String = String(e.item).replace(r,"")+currentLevel;
//trace(clipName)
if(Map_Collection[clipName]){
Map_Collection[clipName].visible=true;
}
}
}
}
dg.addEventListener(ListEvent.ITEM_CLICK,ShowSymbols);
function ShowSymbols(e:ListEvent):void{
makeAllVisibleF(false);
var r:RegExp = /\W/g;
for(var s:String in e.item){
//trace(currentLevel)
if(e.item){
var clipName :String = String(e.item).replace(r,"")+currentLevel;
//trace(clipName)
if(Map_Collection[clipName]){
Map_Collection[clipName].visible=true;
}
//trace(s,e.item)
//trace(currentLevel)
//if(e.item){
}
}
}
function makeAllVisibleF(b:Boolean):void{
Map_Collection.Mitre'sGate_Level2.visible=b;
Map_Collection.Mitre'sGate_Level3.visible=b;
// and a load more !
}
Envirographics
Copy link to clipboard
Copied
that code shouldn't compile because of your last few lines of code.
Copy link to clipboard
Copied
Hi,
If you refer to the Mitre's Gate with apostrophe you are quite right, we have code that strips out such in dataGrid and feeds system apostrophy and gapless versions whilst displaying still the apostrophy and gap in dg and I should have typed out for the purposes of the forum post the lines:-
Map_Collection.MitresGate_Level2.visible=b;
Map_Collection.MitresGate_Level3.visible=b;
The real code does run :-)...and has a lot more of the sttmnt visible=b lines
ignore also the
// and a load more !
as that was also forum added.
I need to update the requirement though, we feel it best the user hovers, sees various bus routes, then clicks and selects their choice, but if they then hover again, the hover still functions BUT when they move off dataGrid to e.g get at the zoom buttons, display reverts to the clicked selection. If they wish to change their mind and click a different route then that also works, as should hover thereafter in the same way.
When they navigate to Level3 of the map by clicking the District Button the selection still shows, this time with _Level3 MC's displaying. As mentioned we have code that appends _Level3 to dg output when user at Level3.
Envirographics
Find more inspiration, events, and resources on the new Adobe Community
Explore Now