Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

variable pass from rollover buttons to AS on frame

New Here ,
Nov 04, 2007 Nov 04, 2007
Hi
I am creating a weather forecast in which i have to create many rollover buttons by which i can pass different URL(i.e. file path which has the zip code & other code) which goes to action script on frame 1 which has all other coding for weather. I know it sound confusing kindly help.
TOPICS
ActionScript
775
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Nov 04, 2007 Nov 04, 2007
what exactly do you need help with? what is the problem you are having?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 04, 2007 Nov 04, 2007
i have made a button with rollover which should pass a value like sanjose which goes to path(" http://61.16.10.25/_flash/sanjose.aspx") on layer 1 frame 1 which have the action script. below is working fine if i pass the whole path in feedURL, but dont know how to pass city name while rolloover


feedURL = " http://61.16.10.25/_flash/sanjose.aspx";

#include "scripts/content.as"
// fire event to display current weather conditions
dispatchEvent({type:"containerInit", target:this});
// when button is pressed, shift it's position
function btnPressed(btn) {
btn._x += 1;
btn._y += 1;
}
// when button is released, put it back
function btnReleased(btn) {
btn._x -= 1;
btn._y -= 1;
}
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Nov 05, 2007 Nov 05, 2007
I'm not certain that this will work with an aspx page call, but you can pass variables in a URL by adding to the path with something like:

feedURL = " http://61.16.10.25/_flash/sanjose.aspx?zip="+zip+"&code="+code;

Then in the new page the variables 'zip' and 'code' should be available to the script, however you may need to call loadVariables() or use the LoadVars class to get them, not certain, I have not worked with aspx pages. Anyone else on this method?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 05, 2007 Nov 05, 2007
Thanks for the idea

i did this feedURL = " http://172.16.10.25/_flash/" +x+ ".aspx";

it works fine when variable is passed from same page but when i have to pass variable from button rollover something like this

on (rollOver)
{
var x ="San"
}

it doesn't work any more idea
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 06, 2007 Nov 06, 2007
any help

i have created global variable on button

_global.cityname="Delhi"

and pass it to AS2

feedURL = " http://61.16.10.25/_flash/" +_global.cityname+".aspx";

this is working fine my problem is i want to pass _global.cityname="Delhi" on roll over
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 06, 2007 Nov 06, 2007
any one

any help


F8 - i want when rollover the button a value as "Delhi" something like

(_global.cityname="Delhi") this goes to an action script within the line

feedURL = " http://61.16.10.25/_flash/" +_global.cityname+".aspx";


i have to create many button which on rollover send the value of different cityname in the Action script URL

like

button1 = Delhi

button2= Sanjose
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Nov 06, 2007 Nov 06, 2007
sorry, been out. If you define the var outside of the on handler on the main timeline you should then be able to assign a value to the var from the handler. You could do this using a 'global' but you could also call to: _level0.cityname

So place the definition outside of the button instance, on the timeline, then use the rollOver to assign the value (I think you may want to use an on(press) or on(release) event though)
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 06, 2007 Nov 06, 2007
thanks doing that but not succesfully i am new to flash can you show me how to code it
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Nov 06, 2007 Nov 06, 2007
hmmm .... well in the first frame of your swf declare the var, go ahead with a global as in:

_global.cityname = "";

then in the button handler, it should read:

on(rollOver) {
_global.cityname = "Delhi";
}

Now the var should be set to the value of 'Delhi'
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 11, 2007 Nov 11, 2007
i am getting this error

Error opening URL " http://61.16.10.25/_flash/.aspx"
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Nov 11, 2007 Nov 11, 2007
looks like the var is not getting assigned the String previous to the call to the page and it concatenating the null value still. You may need to 're-assign' the feedURL value just previous to calling to the location, do so on a line just before where this call is being made. If the feedURL value is assigned once early on, the value isn't getting changed when the call is made.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 11, 2007 Nov 11, 2007
thanks clbeech

its showing "undefined", can you tell me how exactly i have to 're-assign' the feedURL value

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 11, 2007 Nov 11, 2007
i am also trying this it only shows the b2 result by default

if (b1.onRollOver())
{_global.cityname="San";}
else (b2.onRollOver())
{_global.cityname="Delhi";}

if (b1.onRollOver())
{_global.cityname="San";
trace(_global.cityname);
}
else (b2.onRollOver())
{_global.cityname="Delhi";
trace(_global.cityname);
}

feedURL = " http://61.16.10.25/_flash/" +_global.cityname+".aspx";
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Nov 11, 2007 Nov 11, 2007
LATEST
sorry, this is because these statements won't function, an onRollOver handler can't be a condition. You need to reassigning the value of 'feedUrl' just previous to making the call to the URL to update to the latest variable assignment. Wherever you are calling 'getURL' on a line previous to that call, re-assign the value of feedURL just the way you have it, this will update it, just before the getURL call is made. assigning the value of the _global.cityname in the onRollOver is fine, but you just have to update the feedURL value before making the call.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines