小编Jus*_*tin的帖子

array_map不在类中工作

我正在尝试创建一个类来处理数组,但我似乎无法array_map()在其中工作.

<?php
//Create the test array
$array = array(1,2,3,4,5,6,7,8,9,10);
//create the test class
class test {
//variable to save array inside class
public $classarray;

//function to call array_map function with the given array
public function adding($data) {
    $this->classarray = array_map($this->dash(), $data);
}

// dash function to add a - to both sides of the number of the input array
public function dash($item) {
    $item2 = '-' . $item . '-';
    return $item2;
}

}
// dumps start array …
Run Code Online (Sandbox Code Playgroud)

php arrays class function array-map

43
推荐指数
2
解决办法
4万
查看次数

在Android平板电脑上使用StageVideo闪烁?

我有一个stageVideo类,我用它在平板电脑上播放视频,但每次播放视频时,平板电脑屏幕会闪烁几次(变黑然后大约四次左右)我想知道是什么原因造成的这个.当我通过视频播放切换到视图时,它会执行此操作.视频的网址传递到视频mxml视图.我使用的是flex 4.6和Android平板电脑(EEE变压器素数).

package ios 
{     
import flash.display.Sprite; 
import flash.display.StageAlign; 
import flash.display.StageQuality; 
import flash.display.StageScaleMode; 
import flash.events.Event; 
import flash.events.NetStatusEvent; 
import flash.events.StageVideoAvailabilityEvent; 
import flash.events.StageVideoEvent; 
import flash.geom.Rectangle; 
import flash.media.StageVideo; 
import flash.media.StageVideoAvailability; 
import flash.media.Video; 
import flash.net.NetConnection; 
import flash.net.NetStream; 


[Bindable] 
public class iOSStageVideo extends Sprite 
{ 
    private var videoPath:String; 
    private var videoWidth:Number; 
    private var videoHeight:Number; 
    private var _sv:StageVideo; 
    private var _vd:Video; 
    private var _obj:Object; 
    private var _ns:NetStream; 

    public function iOSStageVideo( path:String , w:Number , h:Number ):void
    { 
        videoPath = path; 
        videoWidth = w; 
        videoHeight = h; …
Run Code Online (Sandbox Code Playgroud)

apache-flex mobile android actionscript-3 flash-builder

7
推荐指数
1
解决办法
1210
查看次数

由于Jquery的$未声明,无法使用ant和closure编译器编译javascript

我试图让谷歌闭包编译器工作来编译我使用Jquery的javascript代码,但我一直在变量$ is unclared有没有办法让它看到$变量.有没有办法让闭包编译器看到Jquery库但不能编译它.这是我的蚂蚁脚本

<?xml version="1.0"?>
<project basedir="." default="compile">

<taskdef name="jscomp" classname="com.google.javascript.jscomp.ant.CompileTask"
       classpath="build/compiler.jar"/>

<target name="compile">

<jscomp compilationLevel="simple" warning="verbose" 
        debug="false" output="output/file.js">

  <sources dir="${basedir}/src">
    <file name="js.js"/><!-- the file I'm trying to compile -->
  </sources>

</jscomp>

</target>

</project>
Run Code Online (Sandbox Code Playgroud)

我的Jquery库名为min.js,它位于带有js.js的src文件夹中

我确信这是一个简单的问题,但我只是遗漏了一些东西.提前致谢!

javascript ant jquery google-closure-compiler

4
推荐指数
1
解决办法
3313
查看次数

无法在javascript中使用this.function_name获取setInterval函数来调用另一个函数

我在一个对象中有一个函数,它设置了一个调用另一个函数的间隔,但是当这个间隔函数被调用时,它会给我一个错误,说 Uncaught TypeError: Object [object Window] has no method

这是我试图理解的代码。

function test2() {
this.timer;

this.say = function(){
    console.log("hi");
}

this.start = function() {
    //starts the interval function
    this.timer = setInterval(this.loop, 1000)
}

this.loop = function() {
    //runs every 1 second  
    this.say(); //gives error -- Uncaught TypeError: Object [object Window] has no method 'say'
}
}

var test = new test2();
test.start();
Run Code Online (Sandbox Code Playgroud)

感谢您的帮助!

javascript

3
推荐指数
1
解决办法
2582
查看次数

PHP是否在分配时复制对象?

PHP在=使用时是复制对象还是仅创建指向已存在对象的新指针?

这些都是一样的吗?

$obj1 = new object(); 
$obj2 = $obj1;

$obj1 = new object(); 
$obj2 = clone $obj1;
Run Code Online (Sandbox Code Playgroud)

php

1
推荐指数
1
解决办法
44
查看次数