重构从AS3传递到PHP的URL

时间:2013-01-14 02:17:27

标签: php actionscript-3 get

从AS3传递vars到php时因为url结构而且在pagename和vars之间没有%,因此读取变量时出现问题。 像这样http://xx.xxx.xx.xxx/wordpress/?page_id=81imageName=White

我尝试在wordpress中使用永久链接来解决这个问题,现在我完全错过了数据的第一部分 像这样http://xx.xxx.xx.xxx/wordpress/catch-page/?imageURL ......图像名称只是缺失而我的捕获字符串没有获取数据

$tmp_id=$_GET['imageID'];
$tmp_url=$_GET['imageURL'];
$tmp_name=$_GET['imageName'];

有关解决此事的任何建议吗?

以下是闪存的部分(可能会有所帮助:))

package  
{

    import flash.display.MovieClip;
    import flash.utils.Timer;
    import flash.events.TimerEvent;
    import fl.transitions.Tween;
    import fl.transitions.easing.*;
    import fl.transitions.TweenEvent;

    public class eggHolderMCMain2 extends MovieClip 
    {
        public var myID:String;
        var updateThisEgg:Timer = new Timer(5000);
        var fadeInTimer:Timer = new Timer(5500);
        public var newID:Boolean;
        public var myType:String;
        public var clickable:Boolean = true;
        var updating:Boolean = false;

        //NEW VARIABLES: Add it HERE as a PUBLIC VAR "my" <something> then go to Main3 and edit it twice there
        public var myPath:String;
        public var myName:String;

        //defaults to the first ever generated egg
        public function eggHolderMCMain2() 
        {
            updateThisEgg.addEventListener(TimerEvent.TIMER, updateMe);
            fadeInTimer.addEventListener(TimerEvent.TIMER, fadeIn);
            updateThisEgg.start();

            this.gotoAndStop(randomRange(1,this.totalFrames));
            myID = "0";
            updateThisEgg.start();

        }
        //forces ID update
        public function toggleID()
        {
            trace("inside toggleID")
            newID = true;
        }

        //updates the ID's 
        public function changeID(lastNumber:Number)
        {
            trace("Inside changeID")
            if(this.currentFrame == 1 && newID == true)
            {
                myID = String(lastNumber);
                //myID = "beagle" + String(createRandomPassword(3,false,true,false) + randomRange(1,50));
                newID = false;
                myType = "Bald Eagle";
                myPath = "http://xxx/xxx/xxx/serverImages/baldEagleEgg.png";
                myName = "BaldEagle.png";
            }

            else if(this.currentFrame == 2 && newID == true)
            {
                myID = String(lastNumber);
                //myID = "gowl" + String(createRandomPassword(3,false,true,false) + randomRange(1,50));
                newID = false;
                myType = "Great Owl";
                myPath = "http://xxx/xxx/xxx/serverImages/greatOwlEgg.png";
                myName = "GreatOwl.png";
            }
            return(myID);
        }

        //generates a random number
        function randomRange(minNum:Number, maxNum:Number):Number   
        {  
            return (Math.floor(Math.random() * (maxNum - minNum + 1)) + minNum);  
        }  

这个

package  
{
    import flash.display.MovieClip;
    import eggHolderMCMain2;
    import flash.utils.Timer;
    import flash.events.TimerEvent;
    import flash.events.MouseEvent;
    import flash.net.URLVariables;
    import flash.net.URLRequest;
    import flash.net.navigateToURL  

    public class Main3 extends MovieClip 
    {
        public var knownIDs:Array;
        var myVariables:URLVariables = new URLVariables();
        var myURLRequest:URLRequest = new URLRequest("http://xxx/xxx/catch-test/")
        public var numberTrack:Number;


        public function Main3() 
        {
            var newEgg:eggHolderMCMain2 = new eggHolderMCMain2();
            //eggUpdater.addEventListener(TimerEvent.TIMER, updateArray);   
            eggContainer.addEventListener(MouseEvent.CLICK, clickedMe);
            //eggUpdater.start();
            numberTrack = 0;


            //ADD HERE as a PROPERTY onto myVariables with a DIFFERENT NAME "image"
            myVariables.imageURL = "";
            myVariables.imageID = "";
            myVariables.imageName = "";
            myURLRequest.data = myVariables;            

        }

        public function clickedMe(evt:MouseEvent)
        {
            trace("inside clickedme")
            eggList.text = String(myURLRequest);
            var tempObject = evt.target;
            if(tempObject.clickable == true)
            {
                tempObject.toggleID();
            }
            tempObject.changeID(numberTrack);
            numberTrack += 1;
            clickable(tempObject);
        }


        public function clickable(eggObject:Object)
        {
            trace("inside clickable")
            var tempObject = eggObject;
            if(tempObject.clickable == true)
            {
                //tempObject.changeID();

                eggList.appendText(" " + tempObject.myID + " of type: " + tempObject.myType)
                tempObject.fadeOut();


                //SEND IT OUT HERE
                myVariables.imageID = tempObject.myID;
                myVariables.imageURL = tempObject.myPath;
                myVariables.imageName = tempObject.myName;

                try
                {
                    navigateToURL(myURLRequest, '_blank');
                }
                catch(e:Error)
                {
                    trace("Error Occured!");
                }
            }
            else
            {
                eggList.appendText(" This egg is already taken ")
                //trace("This egg is already taken")
            }
        }


        public function updateArray(evt:TimerEvent)
        {
            for(var i:int = 0; i < eggContainer.numChildren; i++)
            {
                //trace("inside UpdateArray")
                var tempObject = eggContainer.getChildAt(i);
                tempObject.changeID();
                //trace(tempObject.myID);
            }
        }

        //Unknown function
/*      public function delayClicks(egg:Object)
        {
            var tempObject = egg;
            tempObject.updateMeDirect();

        }*/

    }

}

0 个答案:

没有答案