Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Composer not working
Started by filippo66627 Jan 14 2020 02:28 PM

60 replies to this topic
[TOPIC CONTROLS]
Page 2 of 3 1 2 3
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#26

nick_sherman

[GLOBAL: userInfoPane.html]
nick_sherman
  • Corona Geek

  • 1,976 posts
  • Corona SDK

So if it works with a blank template, add your code in section by section until it breaks.



[TOPIC: post.html]
#27

filippo66627

[GLOBAL: userInfoPane.html]
filippo66627
  • Enthusiast

  • 66 posts
  • Corona SDK

So if it works with a blank template, add your code in section by section until it breaks.

As soon as i add
Local background = display.newImageReact ("Background")
It doesn't work

[TOPIC: post.html]
#28

jdsmedeirosbr

[GLOBAL: userInfoPane.html]
jdsmedeirosbr
  • Enthusiast

  • 98 posts
  • Corona SDK

Try what nick_sherman said, delete everything from menu2 and just put the composer scene template, then put a print ("Hello") inside the create function. See if it gives error


  • filippo66627 likes this

[TOPIC: post.html]
#29

nick_sherman

[GLOBAL: userInfoPane.html]
nick_sherman
  • Corona Geek

  • 1,976 posts
  • Corona SDK

As soon as i add Local background = display.newImageReact ("Background") It doesn't work

 

 

How doesn't it work? Same error as before? Does the image exist? Precision is important in coding, there's several errors in that line, but I have no idea if those are just lazy typos on your post or in the actual code. 



[TOPIC: post.html]
#30

filippo66627

[GLOBAL: userInfoPane.html]
filippo66627
  • Enthusiast

  • 66 posts
  • Corona SDK

How doesn't it work? Same error as before? Does the image exist? Precision is important in coding, there's several errors in that line, but I have no idea if those are just lazy typos on your post or in the actual code.

Yes it gives the same error

[TOPIC: post.html]
#31

filippo66627

[GLOBAL: userInfoPane.html]
filippo66627
  • Enthusiast

  • 66 posts
  • Corona SDK

Try what nick_sherman said, delete everything from menu2 and just put the composer scene template, then put a print ("Hello") inside the create function. See if it gives error

It doesn't give any errors but theres just a black screen and it doesnt print Hello or set my background when i type in local background = display.newImageReact ("background") in the create scene :/

[TOPIC: post.html]
#32

nick_sherman

[GLOBAL: userInfoPane.html]
nick_sherman
  • Corona Geek

  • 1,976 posts
  • Corona SDK

As jdsmedeirosbr said, put in a line of code that everyone can agree should work. If that breaks then something weird is going on.

 

print ("Hello")


[TOPIC: post.html]
#33

nick_sherman

[GLOBAL: userInfoPane.html]
nick_sherman
  • Corona Geek

  • 1,976 posts
  • Corona SDK

It doesn't give any errors but theres just a black screen and it doesnt print Hello or set my background when i type in local background = display.newImageReact ("background") in the create scene :/

 

No errors in the console at all...? (the bit at the bottom)

 

Screenshot%202020-01-15%20at%2021.10.10.



[TOPIC: post.html]
#34

filippo66627

[GLOBAL: userInfoPane.html]
filippo66627
  • Enthusiast

  • 66 posts
  • Corona SDK

No errors in the console at all...? (the bit at the bottom)

Screenshot%202020-01-15%20at%2021.10.10.

no errors at all just a black screen and it doesn't print whatever in type in

[TOPIC: post.html]
#35

nick_sherman

[GLOBAL: userInfoPane.html]
nick_sherman
  • Corona Geek

  • 1,976 posts
  • Corona SDK

It won't print it on screen, it will be in the section called 'output (running)' in zerobrane.

 

Can you zip up your project and upload it?



[TOPIC: post.html]
#36

filippo66627

[GLOBAL: userInfoPane.html]
filippo66627
  • Enthusiast

  • 66 posts
  • Corona SDK

It won't print it on screen, it will be in the section called 'output (running)' in zerobrane.


Can you zip up your project and upload it?

yea i know theres nothing on the output section how do i upload files here? tysm

[TOPIC: post.html]
#37

jdsmedeirosbr

[GLOBAL: userInfoPane.html]
jdsmedeirosbr
  • Enthusiast

  • 98 posts
  • Corona SDK

no errors at all just a black screen and it doesn't print whatever in type in

 

Everything is very confusing, you in this print are not showing the main file, and I am not seeing any menu2.lua file in the same directory as the main file! Also, the code you posted: display.newImageReact ("background"), is wrong!



[TOPIC: post.html]
#38

jdsmedeirosbr

[GLOBAL: userInfoPane.html]
jdsmedeirosbr
  • Enthusiast

  • 98 posts
  • Corona SDK

yea i know theres nothing on the output section how do i upload files here? tysm

 

More reply options button



[TOPIC: post.html]
#39

filippo66627

[GLOBAL: userInfoPane.html]
filippo66627
  • Enthusiast

  • 66 posts
  • Corona SDK

Everything is very confusing, you in this print are not showing the main file, and I am not seeing any menu2.lua file in the same directory as the main file! Also, the code you posted: display.newImageReact ("background"), is wrong!

i know sorry im not the best at explaining things how do i upload files here? So u guys can see

[TOPIC: post.html]
#40

filippo66627

[GLOBAL: userInfoPane.html]
filippo66627
  • Enthusiast

  • 66 posts
  • Corona SDK

More reply options button

 



[TOPIC: post.html]
#41

nick_sherman

[GLOBAL: userInfoPane.html]
nick_sherman
  • Corona Geek

  • 1,976 posts
  • Corona SDK

Everything is very confusing, you in this print are not showing the main file, and I am not seeing any menu2.lua file in the same directory as the main file! Also, the code you posted: display.newImageReact ("background"), is wrong!

 

That screenshot was from my system to show where the console is :)



[TOPIC: post.html]
#42

filippo66627

[GLOBAL: userInfoPane.html]
filippo66627
  • Enthusiast

  • 66 posts
  • Corona SDK

 

 

 

That screenshot was from my system to show where the console is :)

 

Attached Files

  • Attached File  App.zip   250.1KB   5 downloads


[TOPIC: post.html]
#43

jdsmedeirosbr

[GLOBAL: userInfoPane.html]
jdsmedeirosbr
  • Enthusiast

  • 98 posts
  • Corona SDK

That screenshot was from my system to show where the console is :)

:o  :D



[TOPIC: post.html]
#44

nick_sherman

[GLOBAL: userInfoPane.html]
nick_sherman
  • Corona Geek

  • 1,976 posts
  • Corona SDK

How are you running the project? Are you using the green triangle at the top in zerobrane?



[TOPIC: post.html]
#45

nick_sherman

[GLOBAL: userInfoPane.html]
nick_sherman
  • Corona Geek

  • 1,976 posts
  • Corona SDK

This is the console output from your project:

 

Copyright © 2009-2019  C o r o n a   L a b s   I n c .

Version: 3.0.0
Build: 2019.3476
Loading project from:   ~/Downloads/App
Project sandbox folder: ~/Library/Application Support/Corona Simulator/App-BC9C92993AB3FAB1782919163EC19C01
Platform: GenericAndroidDevice / x86_64 / 10.14.5 / Intel Iris OpenGL Engine / 2.1 INTEL-12.9.22 / 2019.3476 / en-GB | GB | en_GB | en
ERROR: /Users/nick/Downloads/App/menu2.lua:23: display.newImageRect() bad argument #2: width expected, but got no value
Hello


[TOPIC: post.html]
#46

jdsmedeirosbr

[GLOBAL: userInfoPane.html]
jdsmedeirosbr
  • Enthusiast

  • 98 posts
  • Corona SDK

I downloaded it here, tested it on Zerobrane and it's normal.



[TOPIC: post.html]
#47

filippo66627

[GLOBAL: userInfoPane.html]
filippo66627
  • Enthusiast

  • 66 posts
  • Corona SDK

How are you running the project? Are you using the green triangle at the top in zerobrane?

Yes does the background appear on your console? 



[TOPIC: post.html]
#48

nick_sherman

[GLOBAL: userInfoPane.html]
nick_sherman
  • Corona Geek

  • 1,976 posts
  • Corona SDK

It won't, because the syntax is wrong, and even if you corrected that, "Sfondi/menu2.png" does not exist in the project.



[TOPIC: post.html]
#49

jdsmedeirosbr

[GLOBAL: userInfoPane.html]
jdsmedeirosbr
  • Enthusiast

  • 98 posts
  • Corona SDK

Yes does the background appear on your console? 

 

local sfondo = display.newImageRect( "sfondonero.png", device_width, device_height) is correct!



[TOPIC: post.html]
#50

filippo66627

[GLOBAL: userInfoPane.html]
filippo66627
  • Enthusiast

  • 66 posts
  • Corona SDK

It won't, because the syntax is wrong, and even if you corrected that, "Sfondi/menu2.png" does not exist in the project.

Can you try and put my code in between the switch scene templaye to se if it works?

device_width = display.contentWidth --larghezza in pixel dello schermo del tel
device_height = display.contentHeight --altezza in pixel dello schermo del tel
local coomposer = require ("composer")
--impostazione sfondo 
local sfondo = display.newImageRect( "sfondonero.png",device_width,device_height)
 
sfondo.x= device_width/2
sfondo.y= device_height/2
 
--richiamo libreria per i widgets 
local widget = require("widget")
 
--funzione che viene richiamata quando il bottone viene premuto quindi quando è nello stato "ended" 
 
local function handleButtonEvent ( event )
  local phase = event.phase 
  if "ended" == event.phase then 
    print ("Hello World") 
  end 
end 
 
--creazione bottone numero 1 
local button1 = widget.newButton
 
{
  left = 35 ,
  top = 400 ,
  width = 22 ,
  height = 54,
  defaultFile = ("Sfondi/icons/1.png"),
  overFile = ("Sfondi/icons/1.png"),
  onEvent = handleButtonEvent
}
 
--creazione bottone numero 2
local button2 = widget.newButton
 
{
  left = 120 ,
  top = 400 ,
  width = 22 ,
  height = 54,
  defaultFile = ("Sfondi/icons/2.png"),
  overFile = ("Sfondi/icons/2.png"),
  onEvent = handleButtonEvent
}
 
--creazione bottone numero 3 
local button3 = widget.newButton
 
{
  left = 205 ,
  top = 400 ,
  width = 22 ,
  height = 54,
  defaultFile = ("Sfondi/icons/3.png"),
  overFile = ("Sfondi/icons/3.png"),
  onEvent = handleButtonEvent
}
 
--creazione bottone addizione 
local button_addizione = widget.newButton
 
{
  left = 279,
  top = 417 ,
  width = 22 ,
  height = 20,
  defaultFile = ("Sfondi/icons/Group 57.png"),
  overFile = ("Sfondi/icons/Group 57.png"),
  onEvent = handleButtonEvent
}
 
--creazione bottone numero 0
local button0 = widget.newButton
 
{ left = 120,
  top = 490 ,
  width = 22,
  height = 54,
  defaultFile = ("Sfondi/icons/0.png"),
  overFile = ("Sfondi/icons/0.png"),
  onEvent = handleButtonEvent
}
 
--creazione bottone punto decimale 
local button_decimale = widget.newButton
 
{ left = 210,
  top = 523 ,
  width = 11,
  height = 11,
  defaultFile = ("Sfondi/icons/Ellipse 14.png"),
  overFile = ("Sfondi/icons/Ellipse 14.png"),
  onEvent = handleButtonEvent
}
 
--creazione bottone uguale 
local button_uguale = widget.newButton
 
  left = 265,
  top = 494,
  width = 50,
  height = 50 ,
  defaultFile = ("Sfondi/icons/Group 55.png"),
  overFile = ("Sfondi/icons/Group 55.png"),
  onEvent = handleButtonEvent
}
 
-- creazione bottone numero 4 
local button4 = widget.newButton
 
{ left = 35 ,
  top = 330 ,
  width = 22,
  height = 54 ,
  defaultFile = ("Sfondi/icons/4.png"),
  overFile = ("Sfondi/icons/4.png"),
  onEvent = handleButtonEvent
}
 
-- creazione bottone numero 5 
local button5 = widget.newButton
 
{ left = 120,
  top = 330 ,
 width = 22 ,
 height = 54 ,
 defaultFile = ("Sfondi/icons/5.png"),
 overFile = ("Sfondi/icons/4.png"),
 onEvent = handleButtonEvent
}
 
--creazione bottone numero 6 
local button6 = widget.newButton
 
{left = 205,
  top = 330,
  width = 22,
  height = 54,
  defaultFile = ("Sfondi/icons/6.png"),
  overFile = ("Sfondi/icons/6.png"),
  onEvent = handleButtonEvent
}
 
--creazione bottone sottrazzione 
 
local button_sottrazione = widget.newButton
 
{
  left = 277,
  top = 348 ,
  width = 27 ,
  height = 4,
  defaultFile = ("Sfondi/icons/Rectangle -2.png"),
  overFile = ("Sfondi/icons/Rectangle -2.png"),
  onEvent = handleButtonEvent
}
 
--creazione bottone numero 7 
 
local button7 = widget.newButton
 
{ left = 35,
  top = 260,
  width = 22,
  height = 54,
  defaultFile = ("Sfondi/icons/7.png"),
  overFile = ("Sfondi/icons/7.png"),
  onEvent = handleButtonEvent
}
 
--creazione bottone numero 8
 
local button8= widget.newButton
 
{ left = 120,
  top = 260,
  width = 22 ,
  height = 54,
  defaultFile = ("Sfondi/icons/8.png"),
  overFile = ("Sfondi/icons/8.png"),
  onEvent = handleButtonEvent
}
 
--creazione bottone numero 9
 
local button9= widget.newButton
 
{
  left = 205 ,
  top = 260 ,
  width = 22 ,
  height = 54,
  defaultFile = ("Sfondi/icons/9.png"),
  overFile = ("Sfondi/icons/9.png"),
  onEvent = handleButtonEvent
}
 
-- creazione bottone moltiplicazione 
 
local button_moltiplicazione = widget.newButton
 
{ left = 278,
  top = 277 ,
  width = 23.38 ,
  height = 23.23,
  defaultFile = ("Sfondi/icons/Group 51.png"),
  overFile = ("Sfondi/icons/Group 51.png"),
  onEvent = handleButtonEvent
}
 
--creazione bottone cancella 
button_canc = widget.newButton
 
{ left = 265, 
  top = 207,
  width = 39.51,
  height = 26,
  defaultFile = ("Sfondi/icons/Group 41.png"),
  overFile = ("Sfondi/icons/Group 41.png"),
  onEvent = handleButtonEvent
}
 
--creazione bottone percentuale 
 
local button_percentuale = widget.newButton
 
{ left = 207 ,
  top = 207 ,
  width = 21.96 ,
  height = 24.73 ,
  defaultFile = ("Sfondi/icons/Group 49.png"),
  overFile = ("Sfondi/icons/Group 49.png"),
  onEvent = handleButtonEvent
}
 
--creazione bottone divisione 
 
local button_divisione = widget.newButton
 
{ left = 119 , 
  top = 208 ,
  width = 25 ,
  height = 20 , 
  defaultFile = ("Sfondi/icons/Group 56.png"),
  overFile = ("Sfondi/icons/Group 56.png"),
  onEvent = handleButtonEvent
}
 
--creazione bottone AC 
 
local button_ac = widget.newButton
 
{ left = 35 ,
  top = 206 ,
  width = 26 , 
  height = 28 , 
  defaultFile = ("Sfondi/icons/AC.png"),
  overFile = ("Sfondi/icons/AC.png"),
  onEvent = handleButtonEvent
}
 
--creazione linea di separazione 
 
local button_linea = widget.newButton
 
{ left = -38,
  top = 150 ,
  width = 360 , 
  height = 1 ,
  defaultFile = ("Sfondi/icons/Line 33.png"),
  overFile = ("Sfondi/icons/Line 33.png"),
 
}
 
--creazione bottone menu home  (menu 1 ) 
 
local button_menuhome = widget.newButton
 
{ left = 105 ,
  top = -55 ,
  width = 27 ,
  height = 22 , 
  defaultFile = ("Sfondi/icons/Group 52.png"),
  overFile = ("Sfondi/icons/Group 52.png"),
  onEvent = handleButtonEvent
}
 
--creazione button menu 2 
 
local button_menu2 = widget.newButton
 
{ left = 205 ,
  top = -57 , 
  width = 26 ,
  height = 26 , 
  defaultFile = ("Sfondi/icons/Group 54.png"),
  overFile = ("Sfondi/icons/Group 54.png"),
  onEvent = handleButtonEvent
}



[topic_controls]
Page 2 of 3 1 2 3
 
[/topic_controls]