Asfunction Help
I'm having a hard time workin on this one.... I've got some code:
Code: //this establishes the function hyperlink multicam_fold.blue_txt.intro_blue_txt.htmlText = ("<a href='asfunction:_root.container_1.var_swap,EF1'>EF-1</a>");
//this is the variable var_swap = function(output){ tester = ""+output+""; intro_popup.gotoAndPlay(out); } EDIT: I'm a retard.
intro_popup.gotoAndPlay(out);
---->
intro_popup.gotoAndPlay("out");
two hours of mayhem for TWO FREAKING QUOTES. ARG
KirupaForum > Flash > Flash 8 (and earlier) > Flash MX 2004
Posted on: 07-02-2004, 05:24 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Asfunction
Any ASFUNCTION gurus out there? I posted a form of this question already but got no response. I'm trying to make the asfunction work for me much like the gotoAndStop actionscript. I have an external text box that I want to add a hyperlink that takes me to and stops to a label on the main timeline.
////
the link in the macromedia site which gave me the example:
Note: This is equivalent to assigning "<A HREF="asfunction:myFunction,argument_1">Click here</A>" to an HTML-enabled text field variable.
////
Can't get this to work though.
So, I need some guidance for: hyperlink, gotoAndStop, label on main timeline.
This seems simple enough for someone that knows how to work with the ASFUNCTION. But that's not my bag baby. Any help would be appreciated. Thanks.
ASFUNCTION
1. I have a mc with a dynamic text box that pulls html text from an external .txt file.
2. Within this .txt file I'm trying to use "<A HREF="asfunction:myFunction,argument_1">Click here</A>
3. What I want it to do is load another .txt file into a different text field.
This is all for an FAQ seciton on a web site. I want the questions in the top text box, when some clicks on the question it didplays the answer in the bottom text box.
Reference:
http://www.macromedia.com/support/fl...asfunction.htm
Thanks for any and all help. I've hit a brick wall.
Please Help - AsFunction
Im using asFunction in my html formatted text files and its working great apart from one thing.
As soon as i put the swf in a html file it stops working.
Any ideas?
The code is:
function gsLabel(label) {
_root.gotoAndStop(label);
}
My text file has the following HREF:
<A HREF="asfunction:gsLabel,sleep">get enough good quality sleep</A>
cheers
J
Asfunction: Is This Possible?
I'm using the follwoing asfunction to send the flash player to frame 5 of my movie and it works fine:
Code:
function goto () { clickme = gotoAndStop(5); }
what I need to know is is it possible to change the frame the player goes to from the . txt that I'm using. This is because my client needs to be able to target different parts of the flash move when they update the text file.
Is there anyway this can be done??
Asfunction
hi,
I am trying to use asfunction in Html format text to call myFunction and trying to get respective argument value each time i'll click targeted word..
my arg value arrStr[index] should be different.
right now it is inside the ' ' so thats not rigth i suppose.
Chk fla file if you can help me out
thanx!
//My code.............................
myText_txt.html = true;
myText_txt.autoSize = true;
str = "Ram is a hero of Ramayan";
strnew = "Sita is mother of two kids";
var arrStr = str.split(" ");
trgWord = new Array("Ram", "hero");
var index;
for (var i = 0; i<arrStr.length; i++) {
trace("arrStr[i] = " add i add arrStr[i]);
for (j=0; j<=i; ++j) {
if (arrStr[i] eq trgWord[j]) {
trace("match");
index = i;
arrStr[i] = "<A HREF='asfunction:myFunction,arrStr[index]'><font color='#FF0000'>"+arrStr[index]+"</font></a>";
}
}
}
trace("arrStr="+arrStr);
myText_txt.htmlText = myText_txt.htmlText add " " add arrStr.join(" ");
function myFunction(val) {
dd=val
trace(dd);
}
Asfunction
Can I use Asfunction in onrollover event in a dyn input?
How?
AsFunction...
Flash movie:
function myFunction (params) {
argArray = new Array();
loadMovieNum (argArray[0], 1);
stop ();
}
HTML:
<A HREF="asfunction:myFunction,product.swf">Test</a>
The only problem is, the comma sign ( , ) is used in my text file to split records. So basically i want to know if there is a way to do <A HREF="asfunction:myFunction,product.swf"> without using the comma sign?
Asfunction
Hello
I have a function
function loadmovie(name) {
loadMovieNum(name, 1);
}
this one works fin with <a href="asfunction:loadmovie, test.swf>test</a>
juhuu the test.swf is loaden on level 1
but now i want to use
function loadmovie(name,place) {
loadMovieNum(name, place);
}
but now as i use <a href="asfunction:loadmovie, test.swf, drop>test</a>
nothing happens
what is my mistake??
Thanx in advance
Gilo
Asfunction Help
Hi how can I put an variable in an asfunction
Code:
ipNR = 0;
for (var u = 0 ; u < url_arr.length ; u++) {
ipNR++
link_txt += "<A HREF="asfunction:addPath,ipNR">"+url_arr[u]+"</A><BR>";
}
function addPath (arg) {
trace ("argument was"+arg);
}
ipNR is a variable that keeps changing but what I have now is.. that the trace always put out "ipNR" instead of the counted nr..
Asfunction
I want to ad a gotoANDPlay() function to a piece of text in my website with using asfunction but whatever I try it doesn't work...
I select a piece of the text and fill in asfunction:gotoAndPlay(15) (on the place where you normally put a link in properties)in the hope when I click on that piece of text that in the swf it will go to that frame... But sadly enough nothing happens, while another textbutton on which I used asfunction:Play does work...
Can anyone give me the solution or explain this to me in noobienoobielanguage cause untill now people tend to explain it in a to high lvl for me (and that happens sooner then I like to admit)... So I would really apreciate it when someone would planly write the answer in what I have to type like.-----> asfunction:blabla(16) for instance....
Using ASFUNCTION
I'm trying to use the ASFUNCTION command... I copy/pasted the help example in Flash, just place a textfield.. make sure the html is on
and it works fine...
code:
function MyFunc(arg){
trace ("You clicked me! Argument was "+arg);
}
myTextField.htmlText ="<A HREF="asfunction:MyFunc,Foo ">Click Me!</A>";
myTextField.html = true;
The thing is that I will be creating textfields on the fly... and when I do this, the ASFUNCTION doesn't work... here is my code:
txt_data is a blank movie clip to hold the textfields
I also have the sample fla up on the net
go to:
http://www.djcoro.com/ebox/test/test.swf
code:
// SongName Text Format ///////////////////////////////////////////////////
mySongNameFormat = new TextFormat();
mySongNameFormat.color = 0x000000;
mySongNameFormat.font = "Century Gothic"
mySongNameFormat.size = 10;
mySongNameFormat.bold = true;
mySongNameFormat.italic = false;
ntracknum = 1;
ndepth = 0;
nYPosition = 0;
nXPosition = 10;
for (var i = 0; i<listLength.length; i++) {
txt_data.createTextField("my_songname"+i, depth, nXPosition, nYPosition, 0, 0);
eval("txt_data.my_songname" + i).autoSize = "center";
eval("txt_data.my_songname" + i).html = true;
eval("txt_data.my_songname" + i).htmlText = "<A HREF="asfunction:MyFunc,Foo">"+songName[i]+"</A>";
eval("txt_data.my_songname" + i).setTextFormat(mySongNameFormat);
eval("txt_data.my_songname" + i).embedFonts = true;
}
I'm thinking it has something to do with creating text realtime... any suggestions? ;-[
Fania
Asfunction
Hi,
Can I load in a new window an html page if I insert in a text file - to be imported - the following:
<a href="asfunction:getUrl(´page.html','_blank')">OPE N</a>
It's not working...the index page becomes blank.
Kind regards,
Rigel_kent
Asfunction
Hi, i am doing a asfunction for a dynamic textbox. i created alot of functions and wonder if i can make it into 1 function with a parameter
Code:
function load_cot1()
{
loadMovieNum("galore_cot1", 1);
}
function load_cot2()
{
loadMovieNum("galore_cot2", 1);
}
function load_cot3()
{
loadMovieNum("galore_cot3", 1);
}
function load_cot4()
{
loadMovieNum("galore_cot4", 1);
}
function load_cot5()
{
loadMovieNum("galore_cot5", 1);
}
function load_cot6()
{
loadMovieNum("galore_cot6", 1);
}
function load_cot7()
{
loadMovieNum("galore_cot7", 1);
}
function load_cot8()
{
loadMovieNum("galore_cot8", 1);
}
mayb something like
function loadGalore(filename:String)
{
loadMovienum("filename",1)
}
but i nt sure what is the correct scripting
Help With Asfunction
Okay, I'm creating a web site for a restaurant. On the menu, there's going to be a small image of a camera next to the name of each menu item. When the user clicks on the camera, a function is called which shows a photo of the menu item. I need to use asfunction because the menu items are loaded into a text box from an xml document. Here's the code I'm using, and it works just fine:
<a href='asfunction:showItem," + item.nodeValue + ".jpg'><img src='../menu/camera.gif'></a>
The only problem is that I'm settling here. I don't want the user to have to click on the camera. I would prefer for the function to be called when the user puts the mouse over the camera. So, in other words:
Is there any way to make asfunction react to onMouseOver?
I would really appreciate it if anyone could help me out here.
Help With Asfunction
I'm creating a dynamic text field to load a PHP file ... I want to have links in the PHP that create an ASFUNCTION. Right now I have to click the link a couple times in order for it to work.. does anyone know why this is?
Flash:
function MyFunc(jams){
okay =jams;
}
PHP:
a href="asfunction:MyFunc,001"I'm Cameron, I'm Cameron, I'm Cameron, I'm Cameron, /a
http://www.danamediagroup.com/q/test.html
It does weird things when you click on the links as well -- If anyone knows how to fix this.. it'd be much appreciated.
Thanks!
Cameron
Asfunction Help
Can someone explain why this is not working?
Using TextArea with html enabled, external style sheet used to make link style.
In flash as layer, frame 1:
function click(framenum){
gotoAndStop(framenum);
}
In external text file:
<a href='asfunction:click,10'>link text here</a>
Nothing happens when link clicked on....help?? Thanks!
Asfunction Help
I am using asfunction to call a function from a dynamic text field. I want to send variable that have been declared, but it sends the text instead of the value of the variable. Can anyone explain how to just send the value and not the text. Here is an example:
var floor:String;
var x_cord:String;
var y_cord:String;
var pic:String;
Details = function(param:String){
var emplocate = param.split(",");
_root.map.gotoAndStop(emplocate[0]);
_root.locator._x = (emplocate[1]);
_root.locator._y = (emplocate[2]);
_root.picture.contentPath = (emplocate[3]);
}
//asfunction call
floor = nodes[i].childNodes[8].firstChild.nodeValue;
x_cord = nodes[i].childNodes[11].firstChild.nodeValue;
y_cord = nodes[i].childNodes[12].firstChild.nodeValue;
pic = nodes[i].childNodes[10].firstChild.nodeValue;
entry += '<br><a href="asfunction:Details,floor,x_cord,y_cord,pic"> View details</a>';
A trace in the function spits out "floor x_cord Y_cord pic" instead of the values of those variables.
I've been stuck for a while
Asfunction
Could someone please help me out with this?
i have an html text field containing a list of items, each with an anchor tag like this:
ActionScript Code:
<a href="asfunction:linkTo,page">
where "page" is a url to an html document that the fuction "linkTo" opens in another dynamic text field.
here's my code:
ActionScript Code:
var loadHtml:LoadVars = new LoadVars();
loadHtml.onData = function(html:String):Void {
myText.html = true;
myText.htmlText = unescape(html);
};
loadHtml.load("test1.html");
//
function linkTo(page:String):Void {
trace("clicked");
loadHtml.onData = function(html:String):Void {
yourText.html = true;
yourText.htmlText = unescape(html);
};
var newPage:String = page +".html";
loadHtml.load(newPage);
}
This works fine, BUT if i nest the two text boxes in a containing movieClip, "myText" is properly loaded with the html page, but none of the asfunctions work....
Can anyone see where I'm going wrong with this one?
Thank you
AsFunction: In Xml
asFunction: in xml is now replaced with event:
here is my xml....
<text>
<![CDATA[<p>Information used to <font color="#0000FF"/><u><a href="event:_root.doSubstep1"/>develop</a></u> this lesson can be found in the following document(s):<font color="#0000FF"/><u><a href="event:_root.doSubstep2"/>HotWord1</a></u><</p>]]>
</text>
<hotWord>This is a hot word, name and definition 1.</hotWord>
<hotWord2>This is a hot word, name and definition 1a.</hotWord2>
doSubstep1 and 2 are my functions in my action script code. This part of the xml populates one text box in my .fla.
Here is the code that handles this....
ActionScript Code:
maintxt_txt.addEventListener(TextEvent.LINK, doSubstep1);
maintxt_txt.addEventListener(TextEvent.LINK, doSubstep2);
function doSubstep1(linkEvent:TextEvent):void
{
hotWords.hotWord_txt.htmlText = "" + SBList3[SBNum].parent().hotWord;
}
function doSubstep2(linkEvent:TextEvent):void
{
hotWords.hotWord_txt.htmlText = "" + SBList3[SBNum].parent().hotWord2;
}
develop and HotWord1 show up underlined in my text box. But I when you click on develop, i need it to call the doSubstep1 function, and when I click on HotWord1 I need it to call the doSubstep2 function. As the code is right now, they both call doSubstep2. Is there any way to find out which word the user is clickiing on in my text box? Or a different way to do this at all? Any help would be great!!!!
Asfunction Help
I just started to learn how to use the asfunction last week, and am curious as to how I would do this. I would like to have my dynamic text when clicked open up a swf using the asfucntion(I got that figured out) but I also want the same hyperlink to jump to frame 5 in the current movie (Industry Communications). How would I do this? Here is the action script I have so far:
function loadSWF (swfname){
loader.loadMovie (swfname);
}
Here is the text that I have in my .txt file:
<a href="asfunction:loadSWF,IndustryCommunications_Co mpanies.swf">
I have a blank MC labeled "loader" that loads the swf which is working great. How would I enter a second argument to go to frame 5 of my current swf named Industry Communications as well?
'asfunction' Help, Please.
I am loading an external .swf file into my flash movie with the following code:
<a href='asfunction:container.loadMovie,assets/cool.swf'>
The movie loads fine into my container area, however I need it to be working by using my right / left arrow keys to browse through frames in my external .swf. This browsing function is for some reason disabled when it loads. The external .swf works fine when loaded by itself.
How can I get the right / left arrow key browsing to work in my external .swf after it loads into my flash movie?
Thanks to whomever can help. You'll be a hero.
Asfunction
Hi,
Can I load in a new window an html page if I insert in a text file - to be imported - the following:
<a href="asfunction:getUrl(´page.html','_blank')">OPE N</a>
It's not working...the index page becomes blank.
Kind regards,
Kepler
Asfunction Help
Hello, I've done a search and haven't found a solution to my problem.
I have an embedded SWF in an HTML file.
In my HTML, I want to navigate the SWF from text links, "go to frame 2" to advance the SWF etc. Everything I've seen seems to be how to perform this task from within Flash using dynamic text.
In Flash I have given frame 2 the frame name "green"
In Dreamweaver, I'm using the code
<a href="asfunction:gotoAndPlay,green">green</a>
But when I open the HTML I get "Firefox doesn't know how to open this application...(asfunction) isn't associated with any program".
I know I'm doing something wrong, but can't figure out what. Can this function only be done using Java? I see the control shockwave behavior works very poorly on different browsers.
Thanks for any help!
Edited: 05/07/2007 at 10:59:27 AM by zagods
Asfunction
when i use asfunction it works only when i link to a frame above a certain number. for example: i want to asfunction from frame one to frame three or six or eight - and nothing happens. but if i asfunction to frame ten or above it works. what could be the cause of this? thanks!
Asfunction
I need to pass 2 parameters to by using asfunction. How can i do?
Asfunction Help
Ok, I'm trying to figure out how to use "asfunction" a little differently than I have in the past. Unfortunately, I'm not even sure if this is the way I should be going about this.
Basically, here's what I want to do. I want to embed a .swf into an HTML page, and by utilizing a hypertext link on the HTML page, pass a function into the embedded SWF. Essentially, I'd just like to change the frame of a MC within the flash movie using a link in the HTML footer of the page. It's important to note that the HTML is not being loaded via text file into the flash movie.
Obviously just attaching a <a href="asfunction:_root.targetMC.gotoAndStop,1"> before the text isn't going to work, as the browser won't know what to do with this code. Is there some sort of plug-in I'd have to attach, or is there a different method of coding that'll work in this case?
Hopefully someone here will understand how to fix my problem.
Asfunction
I'm using asfunctionf or the first time. It seems that the function is called in the scope of the movieclip parent of the textfield which contains the link. Right?
So if I have a class that contains a movieclip that contains the textfield, how to do I specify that the asfunction should call a method of the class?
Asfunction Help
Hi all
I am developing a small flash site and as always, you get to the end and the customer wants to change something!
Anyway, here is my dilemma that I need advice on. At the moment I have small movieclip buttons in my projects.fla file each with an instance name 1 to 10. When clicked, these buttons load another external movie clip file and an animated sidebar movie based on the instance name of the button that is pressed.
Now, in the sidebar movie clip that is loaded, I load a text file which has text content associated to the externally loaded movie and the text needs to include hyperlinks which when clicked load the same external movies in exactly the same way as the buttons do on my projects.fla file.
Could someone provide a snippet of code which basically runs the code (attached) that is executed from my small movieclip buttons and show me how it will work being called from the asfunction in my text file? Is it possible?
I hope that makes sense and thanks for reading.
Here is the code I have inside my small movieclip buttons.
Attach Code
this.onRelease = function() {
_parent.subNavPress(_name);
picTransition();
_global.kbc = _name;
// activate the sidebar (if required)
_root.sidebar_mc.gotoAndPlay("halfway");
//time delay - allows picTransition time to reach 100%
setTimeout(function () {
_parent.mc_screen.loadMovie("proj_"+_name+".swf");
}, 400);
};
Asfunction
Hi Everyone
Does anyone know if it possible to assign a rollOver event for an asfunction?
Thanks in advance
Asfunction In Xml
Hi all,
I'm trying to call an function in flash from xml. so I used <a> tag and asfunction. But how come when it calls a built-in function in flash, it works. and when it calls a custom function, it just won't work???
function customFunc(a){
trace("here")
}
these are in my xml file:
<a href="asfunction:trace,here">Click</a>
-- okay this one works
<a href="asfunction:customFunc,whatever">Click</a>
-- this one doesn't
Thanks in advance
Asfunction
Sometimes I just can't realize my ideas with flash... :-(
I am loading html formatted data in the dynamic text field using load vars.
In this html data i put some hyperlinks with asfunctions.
HTML LINK:
<a href ="asfunction:myFunction">link<a>
CODE:
function myFunction():void{
myLV.load("data_1.html");
}
I am using this asfunctions to load another html formatted data in the same text field.
That is no problem.
But when I wrote 10 hardcoded functions I realize that there should be a nicer way to do this because I don't want to mess with my flash files everytime I put in another link (for example when I am updating my site).
I just want my site to be more dynamic, when it comes to updating.
I guess I have to write some code which is capable to do this via external file (XML or PHP) .
Can someone give me a direction please.
THANK YOU IN ADVANCE
Asfunction Help Please
Im not sure this is even doable, but based on my limited knowledge I dont see why it isnt working. I am having asfunction passing a simple arg, a string, to a function. In that function I am trying to compare the arg to another var, to see if they are identical strings. It wont work.. not real sure why, I am guessing a weakness in asfunction I am unaware of, or just a general weakness on my ability. I thought maybe eq instead of == but nothing. Anyone that can shed some light on this, or another way to accomplish this would be great, thanks.
Code:
var cat:String = "CLICK ME";
var rat:String = "test";
var dog:String = "test";
test_tf.htmlText += '<A HREF='asfunction:Test_Func,'+rat+' '>'+cat+'</a>';
function Test_Func(arg:String) {
trace(arg);
trace(dog);
if (dog == arg) {
trace("success");
}
}
Asfunction
Hi Everyone
Does anyone know if it possible to assign a rollOver event for an asfunction?
Thanks in advance
Asfunction: Is This Possible?
I'm using the follwoing asfunction to send the flash player to frame 5 of my movie and it works fine:
Code:
function goto () { clickme = gotoAndStop(5); }
what I need to know is is it possible to change the frame the player goes to from the . txt that I'm using. This is because my client needs to be able to target different parts of the flash move when they update the text file.
Is there anyway this can be done??
Asfunction And XML
Background knowledge
I use an XML file to populate news dates and headings (works)
Each article is clickable and goes to a function sending it a variable (works)
The variable I send is the nid within my XML file (The variable is sent correctly when I test it so I know the fucntoin is recieving the variable)
Here is my XML file
Code:
<dates>
<news>
<nid>1</nid>
<ndate>06/06/06</ndate>
<ntitle>Article One</ntitle>
<ncontent>This will be the content for news article 1</ncontent>
</news>
<news>
<nid>2</nid>
<ndate>05/06/06</ndate>
<ntitle>Article Three</ntitle>
<ncontent>This will be the content for news article 2</ncontent>
</news>
<news>
<nid>3</nid>
<ndate>04/06/06</ndate>
<ntitle>Article Three</ntitle>
<ncontent>This will be the content for news article 3</ncontent>
</news>
</dates>
Ok so here is my first question on the asfunction
I am using an asfunction and passing it nid.
eg:
<a href='asfunction:MyFunc,"+nid+"'> here</a>
Now it passes correctly but I want to know what it passes as ie a string, int etc.
The next Question is on XML
Once in my function i want to go thru my xml file again and retrieve the data that matches that nid.
How do I do it?
If I am not clear on an area pls let me know
Thanks in advance
jmcall
---asfunction & Netscape---
I've been using "asfunction" to call functions from text in a dynamically loaded xml document. However, it seems that there is a problem with the "asfunction" working in Netscape (i'm using 4.72). For example, if I try to load a movie like this:
function loadClip(url) {
loadMovie (url, "_level2");
}
and try to call that function from a text link like this:
<a href="asfunction: loadClip, myMovie.swf">Click here.</a>
it works fine in IE, but in Netscape, the movie does not load at all.
I know it's not a problem with the function call because I created a dynamic text field to display the "url" parameter and it displays fine.
I thought it was a problem with the fact that the parameter is not a string. But when I added quotes to it, or tried the String() function, it still didn't work.
Any help would be greatly appreciated.
Problem With Asfunction
A while ago "metaminds" helped another user with getting dynamic text within a MC to gotoAndPlay a frame in another MC.. For your reference, that post was:
http://board.flashkit.com/board/show...hreadid=163600
That worked very well, however, I'm experiencing another problem: MCs within the target MC are also going to a frame.
That may not make sense, so here's an overview of what I have. In frame 1 of my main timeline I've added the following code:
function beginQ1 (frame) {
_root.q1.gotoAndStop(frame);
}
The first MC contains a dynamic text field that contains the following link:
<a href='asfunction:_root.beginQ1,2'>My link</a>
The second MC (named "q1") has a stop action on frame 1 and the content in frame 2 to keep it hidden from view in the main timeline until the above link is clicked. However, I also have several other MCs within q1 that have a blank frame 1 w/ stop action and content in frame 2, which is called upon by clicking a button in q1, and they're also going to frame 2. Does that make sense?
Is there a way to target ONLY the main timeline in q1 without affecting any of its sub MCs?
Asfunction: Would This Be Stable?
As part of an external text file I have variables like this with an asfunction invocation with two parameters. The first parameter is simply the index number of clip in an array and the second is the rate of _alpha decrease for that same clip. This is just a quick test file. Below is an example of what I have with a function called "fade".
This is an example of one of the loaded variables:
&green=When you need to enter <A HREF="asfunction:fade,2|5"><FONT COLOR="#993333">click here.</FONT></A>&
This is the code on frame one of the movie:
loadVariablesNum("external.txt",0);
var clips=new Array();
clips[0]=black;
clips[1]=maroon;
clips[2]=green;
function fade(target){
var info=target.split("|");
trace(info[0]);
trace(info[1]);
clips[info[0]]._alpha-=info[1];//is this part unstable?
}
Everything runs as expected and I can control the clips but I read a post in which Musicman indicated there might be asfunction bugs. If anyone has any insight or known bugs to share I'd appreciate them. Thanks. The dual array operators look strange to me even though they work.
Asfunction Help Required.
Wonder if anybody can help me please:
I have been playing with Flash and XML and have got to the stage where I have displayed an HTML formatted list (dynamically loaded from an external XML file)......
I now want to be able to click on individual items within this list and display further details.
The only way I can think of doing this is to use the asfunction syntax as follows:
<A HREF="asfunction:functionName, parameter1 | parameter2">click here</A>
Clicking on the 'click here' text will then call the function functionName:
function functionName (parameters){
var bothParameters = parameters.split("|");
trace(parameter1[0]);
trace(parameter2[1]);
}
which in this case would trace the two parameters i.e. parameter1 and parameter2.
However, the problem I have and which there may not be a solution is that I want the parameters to be variables based on where the user clicks i.e. if it is a numbered list the parameters could be these numbers. Although I have created these variables with Actionscript they are not getting called by the function.....the function always calls the parameter text which is input within the HREF tags.
Is is the case that using asfunction within HREF tags that variables cannot be used?
If so is there anyway round this?
Don't expect much response to this as I suspect it's a bit of a bugger to solve but am ever hopeful!!
Thanks
Sean
The following is a segment of code I have been using:
function getDates(month,year){
dateStr = "";
//trace(month + year); //Check it's picking up the variables
for(i=0;i<=zepTourDates.firstChild.childNodes.leng th;i++){
//following if statements used to convert month values from Jan,Feb
//etc into figures i.e. 1,2,3 so as to be compatible with the
//next if statement which pulls it's values directly from the XML doc
//which were entered as 1,2,3......perhaps should have made standard
//entries for both however this is good practice!!
if(month == "Jan") {
month = "1";
}else if (month == "Feb"){
month = "2";
}else if (month == "Mar"){
month = "3";
}else if (month == "Apr"){
month = "4";
}else if (month == "May"){
month = "5";
}else if (month == "Jun"){
month = "6";
}else if (month == "Jul"){
month = "7";
}else if (month == "Aug"){
month = "8";
}else if (month == "Sep"){
month = "9";
}else if (month == "Oct"){
month = "10";
}else if (month == "Nov"){
month = "11";
}else if (month == "Dec"){
month = "12";
}else if (month == "All"){
month = "All";
}
if(zepTourDates.firstChild.childNodes[i].firstChild.firstChild.nextSibling.firstChild.node Value == month && zepTourDates.firstChild.childNodes[i].firstChild.firstChild.firstChild.nodeValue == year){
sDay = zepTourDates.firstChild.childNodes[i].firstChild.firstChild.nextSibling.nextSibling.fir stChild.nodeValue;
sMonth = zepTourDates.firstChild.childNodes[i].firstChild.firstChild.nextSibling.firstChild.node Value;
sYear = zepTourDates.firstChild.childNodes[i].firstChild.firstChild.firstChild.nodeValue;
trace(sDay + sMonth + sYear);
//may not be able to pass variables to the HREF 'asfunction....' method...the book says it
//is always a string!? If I can't pass variables which seems the case then I can't
//achieve what I want this way!!
dateStr +="<font color='#ff0000'><A HREF='asfunction:callSetlist,sDay | sMonth | sYear'>" + zepTourDates.firstChild.childNodes[i].firstChild.firstChild.nextSibling.nextSibling.fir stChild.nodeValue + " ";//<day>5</day>
monthNumber = zepTourDates.firstChild.childNodes[i].firstChild.firstChild.nextSibling.firstChild.node Value;//<month>1</month>
convertMonth(monthNumber);//converts xml month data into Jan, Feb etc
//convertMonth(zepTourDates.firstChild.childNodes[i].firstChild.firstChild.nextSibling.firstChild.node Value);
dateStr += zepTourDates.firstChild.childNodes[i].firstChild.firstChild.firstChild.nodeValue + "</font></A>";//<year>1969</year>
dateStr += " "
dateStr += zepTourDates.firstChild.childNodes[i].firstChild.nextSibling.firstChild.firstChild.node Value + ", ";//venue
dateStr += zepTourDates.firstChild.childNodes[i].firstChild.nextSibling.firstChild.nextSibling.fir stChild.nodeValue + ", ";//City
dateStr += zepTourDates.firstChild.childNodes[i].firstChild.nextSibling.firstChild.nextSibling.nex tSibling.firstChild.nodeValue + ", ";//state
dateStr += zepTourDates.firstChild.childNodes[i].firstChild.nextSibling.firstChild.nextSibling.nex tSibling.nextSibling.firstChild.nodeValue + "<br />";//country
mainScreen = dateStr;
}else if (month == "All" && zepTourDates.firstChild.childNodes[i].firstChild.firstChild.firstChild.nodeValue == year){
dateStr +="<font color='#ff0000'>" + zepTourDates.firstChild.childNodes[i].firstChild.firstChild.nextSibling.nextSibling.fir stChild.nodeValue + " ";//<day>5</day>
monthNumber = zepTourDates.firstChild.childNodes[i].firstChild.firstChild.nextSibling.firstChild.node Value;//<month>1</month>
convertMonth(monthNumber);//converts xml month data into Jan, Feb etc
//convertMonth(zepTourDates.firstChild.childNodes[i].firstChild.firstChild.nextSibling.firstChild.node Value);
dateStr += zepTourDates.firstChild.childNodes[i].firstChild.firstChild.firstChild.nodeValue + "</font>";//<year>1969</year>
dateStr += " "
dateStr += zepTourDates.firstChild.childNodes[i].firstChild.nextSibling.firstChild.firstChild.node Value + ", ";//venue
dateStr += zepTourDates.firstChild.childNodes[i].firstChild.nextSibling.firstChild.nextSibling.fir stChild.nodeValue + ", ";//City
dateStr += zepTourDates.firstChild.childNodes[i].firstChild.nextSibling.firstChild.nextSibling.nex tSibling.firstChild.nodeValue + ", ";//state
dateStr += zepTourDates.firstChild.childNodes[i].firstChild.nextSibling.firstChild.nextSibling.nex tSibling.nextSibling.firstChild.nodeValue + "<br />";//country
mainScreen = dateStr;
//although above code looks complicated due to length of strings required to access
//down into the hierachy of the XML doc all that is happening is that a check using an
//if statement is made based on the year and month selected by the user...
//the above if statment checks the year and month selected against the XML doc and
//only displays this info.....if the user selects ALL then and if else clause has
//been included to allow for month to be equal to all and then displaying all
//of the relevant year's dates/.
}
}
}
function callSetlist(sDate){
var sDetails = sDate.split("|");
trace(sDetails[0] + sDetails[1] + sDetails[2]);
}
//this function only displays the string sDay sMonth sYear
//despite an early trace proving that sDay sMonth sYear variables where being populated....
Asfunction From Mouseover?
I've been using the asfunction quite a bit recently. I was wondering if anyone knew of a way to have it call the flash function from a rollover/mouseover?
so, instead of having:
<a href='asfunction:myFunction'>click here</a>
which causes myFunction to run when they click the text, it would run myFunction on mouseover
I've tried a few things, replacing HREF with a few different types of mouseover code... but nothing seems to be working.
Any advice or solutions would be greatly appreciated!
thanks,
p.
Asfunction Syntax In MC
I'm having a syntax problem with my asfunction. I practiced the asfunction on a test file with one main timeline. I figured out how to make that work. The problem is trying to run the asfunction from inside a MC calling up an external HTML file to go to a frame in the MC. With me so far?
Here's what I'm trying to do:
I have a MC (movie clip = faqmc) off the main timeline. Inside the MC I have an external HTML file loaded. In that text file I have a HREF that is trying to jump to a labeled frame (faq1) in the MC. Doesn't work because I think I'm having a syntax problem.
Here is the function I have in the first frame of the MC:
function gotoFrame(num) {
gotoAndStop(num);
}
Here is my HREF in my text file:
<A HREF="asfunction:_root.gotoFrame,faq1">click this</A>
Since this worked with one timeline, I figure I'm missing something since I'm trying to do this inside a MC? What am I doing wrong gurus? Do I have to add a MC reference in my HREF? Do I have to put my function in the main time line of the file?
Please lend me your big brains. thank you.
Asfunction (How Can I Put More Than One Thing?)
See if anyone can help me with the sintexis of this:
I´m using asfunction on a text field to run a function:
This is how is excplained in the FLASH MX help.
myTextField.text ="A HREF="asfunction:MyFunc,Foo ">Click Me!";
I tried to pass more than one var like this:
myTextField.text ="A HREF="asfunction:MyFunc,Foo,hello,goodbye ">Click Me!";
And it doesn´t work, I get all the values in one variable, the first one. Do i have to use some other character to separate them or something like that?
I erased some html tags because the message didn´t show right.
Asfunction Not Working
my problem:
i have a movie (flashmovie1.swf) with a html-textfield, i also load an external textfile into that textfield, which uses the scrolling-components that flashmx is providing.
so far so good. everything is working fine, the links in the html are working.
but the problem is, as soon as i make another movie and load the flashmovie1.swf into a movieclip (mc_forloadin) like this.
loadMovie("flashmovie1.swf","mc_forloadin");
the links are not working anymore as soon as i use the scrollbar. but if i drag the scrollbar to the position it started from (0). the links work again ?????
anybody ?
Question About Asfunction
why when i try to use this with a text file that i read from out side and among the text
there is :
<A HREF="asfunction:sendemail,Foo ">press here to send email</A>
when i am loading the text field into a dynamic text field that is set to html it show's
everything but the link and the link text!
why is that
?
thnaks in advace
PEleg
Problem With Asfunction
I have a movieclip that i loadVariables into, one of which is some text that will be used for a dynamic html text field.
I wrote a test function on the movieclip, to be called from "asfunction" when a certain html link is clicked.
Code:
onClipEvent(load) {
myFunction = function(myText) {
trace(myText);
}
this.loadVariables("vars.txt");
}
Then I set the text of the html textbox when the data is loaded.
Code:
onClipEvent(data) {
myHTML.htmlText = '<a href="asfunction:myFunction,test">Click Here</a>';
}
I just have "test" stuck in there so i can see if the asfunction works (which it does not). The text itself does show up properly though (with the link/hand icon over it), and the variables are indeed loaded. When I click it though, I don't get my trace() from the function I defined. can anyone explain what I am doing wrong? Thanks in advance.
Question About Asfunction
why when i try to use this with a text file that i read from out side and among the text
there is :
"<a href="asf:myFunc,var">press here to send email</a>"
when i am loading the text field into a dynamic text field that is set to html it show's
everything, but when i press the link the function myfunc() isnt being called as it should be! why is that?is it beacuse read the file from outsdie?
thnaks in advace
PEleg
Asfunction Issue
hi
i know there are lots of posts on asfunction but i can't seem to see what is going on with these files of mine.
i have a simple test.fla and 2 txt files, marketing.txt and marketing2.txt
i've set up a function:
function loadTextFile (filename) {
trace (filename);
_root.content.loadVariables(filename+".txt");
}
the idea is that marketing.txt is loaded and at the bottom there is a 'read more...' link in the text. this calls asfunction like so:
marketingTxt=<a href="asfunction:loadTextFile,marketing2">Read more...</a>
but nothing is passed to the function. so i tried adding in a button and calling the fucntion like:
on (release) {
_root.loadTextFile("marketing2");
}
that works fine. anyone got any ideas? am i passing the wrong data type to the function?
any help is appreciated. i've attached a .zip file with the 3 necessary files.
thanks
Asfunction Problem
hi,
I wonder what I'm doing wrong. I'm trying to use the asfunction in my dynamic text (external textfile) and I have script it like this:
in a a href-tag
="asfunction:GetWordCamera,label1">camera</a>
In my mainmovie I script the function like this:
GetWordCamera = function () {
loadVariablesNum("ord.txt", "/");
}
what I want to do is to load a new text into the textfield. it seems that the asfunction gets the function GetWordCamera, but the new text doesnt show up. I wonder about two things...
what does label 1 means?
and shouldnt I somewhere tell wich textfiled I want the text to load? now I only have one textfield but if I want more it will be problems I think...
I'm sorry for my bad english but I hope someone can clear this out for me.
|