0 Replies - 4419 Views - Last Post: 29 June 2012 - 06:06 AM

#1 maxwell@  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 45
  • Joined: 23-March 11

Problem calling function via flashVars

Posted 29 June 2012 - 06:06 AM

Hi
I have a working flash banner with three buttons.
I would like to have the same banner on more of my web pages.

The idea is that I will have multiple function blocks each relating to
a particular web page. The web pages will each have a flashVars variable,
that will call its related function block.

I have added the banner to one of the web pages however the buttons are
unresponsive when tested.

Can someone please pin point where I am going wrong?

flashVars varialbe
<param name=FlashVars value="myFlashVar=testFlashVar" />


Actionscript

import flash.events.MouseEvent;
import flash.net.URLLoader;


// set a variable to hold the value of our first flashvar
var myFlashVar:String = "testFlashVar"; 

// set a variable to hold the value of our second flashvar 

var myFlashVar2:String = "secondtest"; 

// set a variable to hold the value of our third flashvar 

var myFlashVar3:String = "anothertest"; 

// set an object to hold all of the parameters (flashvars) passed in from the html 

var paramObj:Object=LoaderInfo(this.root.loaderInfo).parameters; 

function checkForFlashVars():void { 

   // check to see if myFlashVar has a new value passed in from the html; if it does, use this value instead 

   if (paramObj.xmlpath) { 

      myFlashVar = String(paramObj.myFlashVar); 

 	  computers_comp();
    }
 
   if (paramObj.myFlashVar2) { 

      myFlashVar2 = String(paramObj.myFlashVar2); 

   	  computers_publicaccess();
 
   }
   
    if (paramObj.myFlashVar3) { 

      myFlashVar3 = String(paramObj.myFlashVar3); 

   	  computers_staff();
 
   }
}
 
// call the function
 
checkForFlashVars();


//3 Function blocks each relating to a particular web page

function computers_comp():void{

	var fileName:String = "../../public/computers/computers.php";
	
	var post:URLVariables = new URLVariables();
	logOutBtn.addEventListener(MouseEvent.CLICK, onclick);
	
	function onclick(event:MouseEvent):void
	{
		post.logout = "laksfslvs";
		var ureq:URLRequest = new URLRequest(fileName);
		ureq.data = post;
		ureq.method = URLRequestMethod.POST;
		navigateToURL( ureq, "_self");
	}
	
	homeBtn.addEventListener(MouseEvent.CLICK, onclick2);
	function onclick2(event:MouseEvent):void
	{
	   var request:URLRequest = new URLRequest("../../index.php");
	   navigateToURL(request, "_self");
	}
	
	prevBtn.addEventListener(MouseEvent.CLICK, onclick3);
	function onclick3(event:MouseEvent):void
	{
	   var request:URLRequest = new URLRequest("../../index.php");
	   navigateToURL(request, "_self");
	}

}

function computers_publicaccess():void{

	var fileName:String = "../../public/computers/computers_publicaccess.php";
	
	var post:URLVariables = new URLVariables();
	logOutBtn.addEventListener(MouseEvent.CLICK, onclick);
	
	function onclick(event:MouseEvent):void
	{
		post.logout = "laksfslvs";
		var ureq:URLRequest = new URLRequest(fileName);
		ureq.data = post;
		ureq.method = URLRequestMethod.POST;
		navigateToURL( ureq, "_self");
	}
	
	homeBtn.addEventListener(MouseEvent.CLICK, onclick2);
	function onclick2(event:MouseEvent):void
	{
	   var request:URLRequest = new URLRequest("../../index.php");
	   navigateToURL(request, "_self");
	}
	
	prevBtn.addEventListener(MouseEvent.CLICK, onclick3);
	function onclick3(event:MouseEvent):void
	{
	   var request:URLRequest = new URLRequest("computers.php");
	   navigateToURL(request, "_self");
	}

}

function computers_staff():void{

	var fileName:String = "../../public/computers/computers_staff.php";
	
	var post:URLVariables = new URLVariables();
	logOutBtn.addEventListener(MouseEvent.CLICK, onclick);
	
	function onclick(event:MouseEvent):void
	{
		post.logout = "laksfslvs";
		var ureq:URLRequest = new URLRequest(fileName);
		ureq.data = post;
		ureq.method = URLRequestMethod.POST;
		navigateToURL( ureq, "_self");
	}
	
	homeBtn.addEventListener(MouseEvent.CLICK, onclick2);
	function onclick2(event:MouseEvent):void
	{
	   var request:URLRequest = new URLRequest("../../index.php");
	   navigateToURL(request, "_self");
	}
	
	prevBtn.addEventListener(MouseEvent.CLICK, onclick3);
	function onclick3(event:MouseEvent):void
	{
	   var request:URLRequest = new URLRequest("computers.php");
	   navigateToURL(request, "_self");
	}

}




Is This A Good Question/Topic? 0
  • +

Page 1 of 1